I have a web service returning following json:
[
{
"id": "9469",
"title": "A person grabbed by police because being Nigerian he was carrying a Ghanaian passport!",
"introtext": "A person has grabbed by police because being Nigerian he was having a Ghanaian passport!
An individual has gotten by police on the grounds that being Nigerian he was having a Ghanaian visa!
A 29-year-old Nigerian has been captured for endeavoring to get a visa with a falsely acquired Ghanaian travel permit."
}
]
JSONLint is giving following error:
Parse error on line 5:
... "introtext": "A person has grabbe
-----------------------^
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['
I am really unable to understand what is making json invalid here? Is it newline or what? What can I do to make it work? Thanks.
Thanks to @MONTYHS and @AvinashGarg for pointing out the mistake. Newline is causing invalid JSON. To have break lines in my json, I am replacing all newline tags
<br/>
with a special character, e.g.|~
(bar and a tilde). At client side, after parsing json, I replace occurrences of|~
with<br/>
back to display properly.Hope it helps someone. Reference is here.
New line present in introtex, this is valid json check it
Put your whole string in one line. example
]
In case you want line break use