Decoding JSON file using python

Jon Ribbens jon+usenet at unequivocal.co.uk
Wed May 27 21:38:46 EDT 2015


On 2015-05-27, Karthik Sharma <karthik.sharma at gmail.com> wrote:
> I tried modifying the program as follows as per your
> suggestion.Doesn't seem to work.

That's because you didn't modify the program as per their suggestion,
you made completely different changes that bore no relation to what
they said.

> import cjson

What do you think 'import json' (or 'import cjson', or whatever) does?
Hint: it doesn't cause Python to henceforth treat all strings as if
they might contain JSON and to interpret them as such just in case.
As Cameron already said, you have to actually *call* the JSON decoder
to convert the data from its JSON string representation into Python
objects.



More information about the Python-list mailing list