0

I know that many ppl have asked the question but I am still failing to make it work.

I have object which I convert to string with JSON.stringify here is the output

{"blocks":[{"frames_content":"<div id=\"page\" class=\"page\">\n    \n    \t<div class=\"container\" id=\"divider1\">\n    \n    \t\t<div class=\"col-md-12\">\n    \n    \t\t\t<hr class=\"dashed\" data-selector=\"hr.dashed\" style=\"outline: none; cursor: inherit;\">\n    \t\n    \t\t</div><!-- /.col -->\n    \t\n    \t</div><!-- /.container -->\n    \n    </div>","frames_sandbox":false,"frames_loaderFunction":"","frames_height":162,"frames_original_url":"/static/admin-users/pages/elements/divider1.html"}]}

I validated it http://jsonlint.com/ and it is fine

When I try to get it back with JSON.parse('{....}') I am getting error

VM487:1 Uncaught SyntaxError: Unexpected token p in JSON at position 39(…)

Can you pls tell me what is wrong

==== Edit =====

Here is an example http://jsfiddle.net/cbk5pyga/2/

I understand that the error is happening because of the special characters and they have to be escaped....but I cannot do it manually....

How to convert the string which is taken from an element to JSON OBJECT?

user43506
  • 155
  • 3
  • 11

0 Answers0