JSON invalid character '}' looking for beginning of object key string
Solution 1
Correct your JSON syntax:
{
"results": [{
"nameChunk1": [{
"name1": "Sean",
"name2": "Noah"
}],
"nameChunk2": [{
"name1": "Joseph",
"name2": "Sam"
}]
}]
}
Observe that I have added ,
after each array.. and removed ,
after name2
key.
Always use validators such as http://jsonlint.com/ to validate your JSON.
Solution 2
Use any JSON validator like http://jsonlint.com/ to validate your JSON.
Correct JSON is:
{
"results": [{
"nameChunk1": [{
"name1": "Sean",
"name2": "Noah"
}],
"nameChunk2": [{
"name1": "Joseph",
"name2": "Sam"
}]
}]
}
Solution 3
You need to remove the comma's after name2
and then insert a comma between nameChunk1
and nameChunk2
. Valid JSON below:
{
"results": [{
"nameChunk1": [{
"name1": "Sean",
"name2": "Noah"
}],
"nameChunk2": [{
"name1": "Joseph",
"name2": "Sam"
}]
}]
}
Solution 4
There are two issues with the JSON:
- There should be no ',' after last element of an object
- There should be a comma to separate two elements
Below is the valid JSON:
{
"results": [{
"nameChunk1": [{
"name1": "Sean",
"name2": "Noah"
}],
"nameChunk2": [{
"name1": "Joseph",
"name2": "Sam"
}]
}]
}
Comments
-
blaizor almost 2 years
I am attempting to import a
.json
file toparse.com
, and I have encountered many errors while doing so. I solved them sequentially, but after I clickfinish import
, I get the errorinvalid character '}' looking for beginning of object key string
My
JSON
script is, as far as I know, perfectly fine. But I only started usingJSON
two hours ago, so I'm sure there's something wrong with it.{ "results": [{ "nameChunk1": [{ "name1": "Sean", "name2": "Noah", }] "nameChunk2": [{ "name1": "Joseph", "name2": "Sam", }] }] }
So, where is the mysterious invalid
}
? I fear there are many... Keep in mind I am usingJSON
for importing data intoparse.com