This question already has an answer here:
- Parsing values from a JSON file? 5 answers
I'm really new to python and want to write a python script which will create python object by reading a json file.
I want to just pass the json file name as argument to script. I wan to use this python script as template for parsing the json file. Below is my sample json file content
{"?xml":{"@version":"1.0","@encoding":"Windows-1252"},"TestScript":{"TestExperiment":{"Test1":{"Control":[{"@Type":"System.Windows.Forms.TextBox","@Name":"Description","@FormName":"Test1","Text":null,"Visible":"True"},{"@Type":"System.Windows.Forms.TextBox","@Name":"Objective","@FormName":"Test1","Text":null,"Visible":"True"},{"@Type":"System.Windows.Forms.TextBox","@Name":"Test1","@FormName":"Test1","Text":null,"Visible":"True"}]}}}}
The above sample file is very small.. i may need to parse a very big json file.
Thanks,
json.load(open(filename))
should still be just fine. Or is your json larger than RAM? Then you'd need a stream parser, there are some for javascript and java, but I'm not aware of any for Python atm. – qarma Jun 23 '14 at 8:52