I have a JSON response with the style tag in it. When i validate with jsonlint, it shows invalid JSon. Please anyone help me whats wrong in this. when i try to execute the code firefox gives the correct output. But only IE is causing the issue.
For example:
{
"contentHTML": "<style type=\"text/css\">\nbody\n{\n margin:0;
\n \n}\n\n.centerComponents\n{\n margin:auto;
\n text-align:left;
\n}\n\n#element1\n{\n width:984px;
\n}\n\n#c1315402137156\n{\n width:984px;
\n min-height:98px;
\n height:auto !important;
\n height:98px;
\n display:inline;
\n float:left;
\n}\n\n#c1315402137155\n{\n width:984px;
\n min-height:150px;
\n height:auto !important;
\n height:150px;
\n margin:2px 0 0 0;
\n display:inline;
\n float:left;
\n}\n\n#element2\n{\n width:984px;
\n display:inline;
\n float:left;
\n}\n\n#element3\n{\n width:243px;
\n display:inline;
\n float:left;
\n}\n\n#c1315402137154\n{\n width:243px;
\n min-height:547px;
\n height:auto !important;
\n height:547px;
\n margin:20px 0 0 0;
\n display:inline;
\n float:left;
\n}\n\n#c1315402137157\n{\n width:100px;
\n min-height:100px;
\n height:auto !important;
\n height:100px;
\n margin:27px 138px 0 5px;
\n display:inline;
\n float:left;
\n}\n\n#element4\n{\n width:740px;
\n margin:0 0 0 1px;
\n display:inline;
\n float:left;
\n}\n\n#c1315402137257\n{\n width:740px;
\n min-height:5px;
\n height:auto !important;
\n height:5px;
\n margin:30px 0 0 0;
\n display:inline;
\n float:left;
\n}\n\n#c1315402137158\n{\n width:740px;
\n min-height:423px;
\n height:auto !important;
\n height:423px;
\n margin:1px 0 0 0;
\n display:inline;
\n float:left;
\n}\n\n#c1315402137159\n{\n width:740px;
\n min-height:994px;
\n height:auto !important;
\n height:994px;
\n display:inline;
\n float:left;
\n}\n\n<\/style>"
}
I think it’s because you have new lines (actual line breaks, not the
\nsequence) within your JSON, and this being JavaScript, that’s not allowed.Invalid:
Valid: