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,

  • You have direction, so you need to start to implement. If you have problems with your implementation come back with questions. – monkut Jun 23 '14 at 08:09
  • let me try with the above link given by Christian Berendt –  Jun 23 '14 at 08: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. – Dima Tisnek Jun 23 '14 at 08:52
  • it is not duplicate of http://stackoverflow.com/questions/2835559/parsing-values-from-a-json-file-in-python .. Here user needs to convert it into python object with all values. – sia Jun 23 '14 at 08:59

0 Answers0