I have following json in file mock.json
. I am trying to load it via ajax call however, I am getting this error.
Error: Parse error on line 1:
{ id: 1, name: 'My na
--^
Expecting 'STRING', '}', got 'undefined'
I used to jsonlint validator to validate json and getting above error. Whats wrong my json?
[{
id: 1,
name: 'My name',
email: '[email protected]'
}]
The JSON standard describes properties as strings and strings need double quotes "
.
A string is a sequence of zero or more Unicode characters, wrapped in double quotes, using backslash escapes. A character is represented as a single character string. A string is very much like a C or Java string.
So you need double quotes for properties and values as strings in your JSON.
[{
"id": 1,
"name": "My name",
"email": "[email protected]"
}]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With