Reputation: 15639
Can any make this json correct, I am inserting json in JSON online Validator
Getting error that json is not valid, what is error in this json, and how can I make it correct, please don't give links of other tutorials, Thanks
{
mothmap: {
value: [{
longitude: -0.13025200000004133,
latitude: 51.4596619
}, {
longitude: -2.707384100000013,
latitude: 53.7613383
}]
}
}
Upvotes: 0
Views: 32561
Reputation: 13853
JSONLint requires properties to be written in quotes:
{
"mothmap": {
"value": [
{
"longitude": -0.13025200000004133,
"latitude": 51.4596619
},
{
"longitude": -2.707384100000013,
"latitude": 53.7613383
}
]
}
}
However, yours was perfectly valid. JSONLint just complains too much.
Upvotes: 1
Reputation: 29935
If you're using a validator, why didn't you bother to look at the output!
It says:
Parse error on line 1:
{ mothmap: {
-----^ Expecting 'STRING', '}'
EXPECTING STRING means its looking for a string..........
put all the bits BEFORE the :
s inside double quotes...
eg: { "mothmap": { .....
Upvotes: 1
Reputation: 2218
Like this :
{
"mothmap": {
"value": [
{
"longitude": -0.13025200033,
"latitude": 51.4596619
},
{
"longitude": -2.70738400013,
"latitude": 53.7613383
}
]
}
}
Upvotes: 0
Reputation: 5156
{
"mothmap": {
"value": [
{
"longitude": -0.13025200000004133,
"latitude": 51.4596619
},
{
"longitude": -2.707384100000013,
"latitude": 53.7613383
}
]
}
}
Strings need to be in quotes.
Upvotes: 2
Reputation: 18121
You need double quotes around your strings. This passes the validator:
{
"mothmap": {
"value": [
{
"longitude": -0.13025200000004133,
"latitude": 51.4596619
},
{
"longitude": -2.707384100000013,
"latitude": 53.7613383
}
]
}
}
Upvotes: 5