I need to read in a .json file and write out a file with some of the
information from this file. I can't figure out how to read the .json file
in. I know there is a module for this, but I don't understand how it works.
The file I am needing to read is like below (except much much larger)
{
"table":"contacts",
"records":[
{
"name":"John",
"phone":"555-555-4444"
},
{
"name":"Jane",
"phone":"555-555-3333"
},
]
}
I have no clue how to do this. I was thinking something like;
import json
json.dumps([name,phone], seperators(":"))
Would something like this even remotely stand a chance of working? If not
can someone explain the json module to me in a way that is easy to
understand? All my past experience has been in reading ism files in a
different language - I've never read a java file before and haven't done
much python coding either.
If this statement would work, then how do I get it to give me the data for
one record at a time so I can then move it to another file?
I would really appreciate any help I could get with this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100213/fc7f0389/attachment.htm>