Skip to content
Advertisement

JSON JSONDecodeError: Extra data Python

I’m trying to print every value of a Json using Python. There are 3 Json phrases that are seperated by “,” and I get an error if I try to load all of it to the json.loads function.

Here is what I’m trying to do:

JavaScript

and the error I’m getting:

json.decoder.JSONDecodeError: Extra data: line 1 column 55 (char 54)

The only way I got it to work is take every json phrase in that string and use the json.loads() function on it.

so

JavaScript

Advertisement

Answer

The top level of a JSON string must be just one array or object. If you want to have multiple objects, they must be in an array.

JavaScript

When you load this, you’ll get a list of dictionaries.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement