JSON.parse string with quotes

Posted by mjsilva on Stack Overflow See other posts from Stack Overflow or by mjsilva
Published on 2010-06-18T02:32:05Z Indexed on 2010/06/18 2:43 UTC
Read the original article Hit count: 711

Filed under:
|

Hi,

I've this:

JSON.parse('{"130.00000001":{"p_cod":"130.00000001","value":"130.00000001 HDD Upgrade to 2x 250GB HDD 2.5\" SATA2 7200rpm"}}');

http://www.jsonlint.com/ says it's perfectly valid json.

But on execution I have a JSON.parse error.

But, if I change my code to:

    JSON.parse('{"130.00000001":{"p_cod":"130.00000001","value":"130.00000001 HDD Upgrade to 2x 250GB HDD 2.5\\" SATA2 7200rpm"}}');

(note the double backslash)

It works, but now jsonlint gives me invalid json :/

Can someone help to understand this behavior?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about JSON