I am encountering an issue with parsing a JSON string encoded with PHP 5.2 json_encode(). Here is the JSON string:
{"foo":"\\."}
Although this JSON string is valid according to jsonlint.com, when using the native JSON.parse() method in Chrome and Firefox, I receive the following error:
SyntaxError: Unexpected token ILLEGAL
I would like to know why escaped regular expression meta characters cannot be parsed. For instance, this example works:
{"foo":"\\bar"}
But this one fails:
{"foo":"\\?"}
For clarification, \.
is just a simple test regular expression that I want to execute using JavaScript's RegExp object.
Your assistance is greatly appreciated.
Regards,
Dyvor