Leaning JSON, I'd like to think that followed the syntax tips to the tee. I wanted to start loading datasets into JSON and manipulating them using Python. Writing the dataset I started entering the data but I kept getting this error.
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 7 column 2 (char 129)
Although I followed multiple tutorials, I can't get to understand where my error is coming from?
[
{
"name": "x",
"email": "x@x",
"location": "Yorkville Village",
"contacted": "Yes",
},
{
"name": "y",
"email": "y@y",
"location": "Yorkville Village",
"contacted": "Yes",
},
{
"name": "z",
"email": "info@z.com",
"location": "Yorkville Village",
"contacted": "Yes",
},
]
It's expecting "property name enclosed in double quotes", as in "expecting [another] property [with a] name [that is] enclosed in double quotes"; it's expecting another property. This is because you have extra commas at the ends of your k:v
pairs.
You want:
[
{
"name": "x",
"email": "x@x",
"location": "Yorkville Village",
"contacted": "Yes"
},
{
"name": "y",
"email": "y@y",
"location": "Yorkville Village",
"contacted": "Yes"
},
{
"name": "z",
"email": "info@z.com",
"location": "Yorkville Village",
"contacted": "Yes"
}
]
The Json you show in your question is not valid because of the last comma you have in every object.
Here's a valid version:
[
{
"name": "x",
"email": "x@x",
"location": "Yorkville Village",
"contacted": "Yes"
},
{
"name": "y",
"email": "y@y",
"location": "Yorkville Village",
"contacted": "Yes"
},
{
"name": "z",
"email": "info@z.com",
"location": "Yorkville Village",
"contacted": "Yes"
}
]
Always check if your JSON is valid using a JSON validator
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.