In JSON I am getting syntax error but I don’t know why? can someone help in finding the syntax error in it
{
'jokes':[
{
'text':'How many Pear you can eat when your stomach is empty.' + '\n'
'Girl: 7 Pears.' + '\n'
'No, you are wrong, you can eat only one.' + '\n'
'Girl: How can you say that.' + '\n'
'Because when you eat 2nd Pear, your stomach will not empty!'
},
{
'other-text':'Hell, is everything is cool'
}
];
}
In JSON the property names must be double-quotes and not single quotes
Additionally I’m pretty sure that JSON does not support operators to concat strings, a string value should be a single string.
The new lines will depend on your implementation
I think this is more or less what you’re going for:
{
"jokes":[
{
"text":"How many Pear you can eat when your stomach is empty.\nGirl: 7 Pears.\nNo, you are wrong, you can eat only one\nGirl: How can you say that\nBecause when you eat 2nd Pear, your stomach will not empty!"
},
{
"other-text":"Hell, is everything is cool"
}
]
}