Json Parsing Escaped String
Why dosen't JSON.parse parse this: { 'things1': '[{\'stuff1\':\'data1\'}]' } When I enter this JSON.parse('{ 'things1': '[{\'stuff1\':\'data1\'}]' }') I get: Uncaught SyntaxE
You are having escaping issues, specifically because you have nested strings. You need to double escape the \"
bits using \\"
.
Edited: Meant to add a sample.
JSON.parse('{ "things1": "[{\\"stuff1\\":\\"data1\\"}]" }');
Post a Comment for "Json Parsing Escaped String"