python web2py.py -S yourapp -M
>>> import glob
>>> from gluon.contrib.simplejson import load
>>> for f in glob.glob('*.json'):
>>> data = load(open(f,'rb'0))
>>> db.yourtable.insert(**data) ###
### assuming the json data is a dictionary with the same keys as the
columns in db.yourtable.
On Feb 1, 3:22 am, Al <[email protected]> wrote:
> Hi,
>
> I am using web2py to build an application to read a few .JSON files
> which are updated periodically (every 300s), the information within
> the files will be decoded and used to update a database as well update
> some screens. As I am new to all web2py and python, could anyone tell
> me how I can load each json file and assigned it to an array or some
> appropriate data structure. Also in order to detect if the json file
> was updated, are there some built in functions which can detect such a
> change or I have to write code to check after loading it into the
> database. It seems that web2py has a lot of magic functions which can
> be used to make things a lot simpler than other framework or
> languages.
>
> Cheers
> Al
--
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en.