Python JSON processing - extra data error

dieter dieter at handshake.de
Tue Mar 31 02:05:17 EDT 2015


karthik.sharma at gmail.com writes:

> I have the following python program to read a set of JSON files do some processing on it and dump them back to the same folder. However When I run the below program and then try to see the output of the JSON file using
>
> `cat file.json | python -m json.tool` 
>
> I get the following error
>
> `extra data: line 1 column 307 - line 1 column 852 (char 306 - 851)`

You might have got a traceback which would tell you where precisely
the problem was detected. Looking the the code there (Python is "Open Source";
thus, you can look at code) will tell you what apparently went wrong.


"extra data" suggests to me that your JSON input may be invalid.

"1 2", for example could cause such a problem, because it contains
two integers (not a single one) without a containing container.




More information about the Python-list mailing list