I have this String:
[
{'lat':43.4627,'lng':-3.79636,'description':'a'},
{'lat':43.4476,'lng':-3.82948,'description':'b'},
{'lat':43.4228,'lng':-3.82391,'description':'c'}
]
And when I try to validate it here it gives me this error:
SyntaxError: JSON.parse: expected property name or '}' at line 1 column 2 of the JSON data
Can anyone tell me what's wrong with my String?
the mistake you mention
or you can also get :
They are caused because it is necessary to use double quotes to define strings.
This would work correctly:
I recommend you use a json validator in these cases.
Object field names must be enclosed in double quotes instead of single quotes.
Field names must be in double quotes instead of single quotes.
According to the official documentation :