Join the Stack Overflow Community
Stack Overflow is a community of 6.5 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

This question already has an answer here:

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,

share|improve this question

marked as duplicate by EdChum, Marco A., greg-449, David, Dave Halter Jun 23 '14 at 10:48

This question was marked as an exact duplicate of an existing question.

    
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 8:09
    
let me try with the above link given by Christian Berendt – user3295725 Jun 23 '14 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. – qarma Jun 23 '14 at 8:52
    
it is not duplicate of stackoverflow.com/questions/2835559/… .. Here user needs to convert it into python object with all values. – sia Jun 23 '14 at 8:59
    
@qarma - few megs – user3295725 Jun 23 '14 at 9:06