64
rated 0 times
[
70]
[
6]
/ answers: 1 / hits: 25510
/ 14 Years ago, sun, june 13, 2010, 12:00:00
I am using Firefox's native JSON.parse() to parse some JSON strings that include regular expressions as values, for example:
var test = JSON.parse('{regex:/\d+/}');
The 'd' in the above throws an exception with JSON.parse(), but works fine when I use eval (which is what I'm trying to avoid).
What I want is to preserve the '' in the regex - is there some other JSON-friendly way to escape it?
More From » json