2

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,

4
  • You have direction, so you need to start to implement. If you have problems with your implementation come back with questions. Commented Jun 23, 2014 at 8:09
  • let me try with the above link given by Christian Berendt Commented Jun 23, 2014 at 8:13
  • How "big" is your json? is it a few megs? few hundred megs? I reckon 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. Commented Jun 23, 2014 at 8:52
  • it is not duplicate of stackoverflow.com/questions/2835559/… .. Here user needs to convert it into python object with all values. Commented Jun 23, 2014 at 8:59

0