After upgrading to jquery 1.4.1 i noticed there was an error anytime i tried calling json.parse. The issue is part of the regex used in json. it uses a $ in the pattern that conflicts with JQuery's $ shortcut.
I don't want to use the non-conflict option with jquery because i have tons of places i'd have to replace the $ with the new corrected shortcut.
Is there a way to wrap a regex pattern in single quotes or something so the pattern string is handled as literally a string?
Broken section in json-2.0.js: (fails on the $)
if (/^[\],:{}\s]*$/.
test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
.....
}
Thanks
Update:
The problem was not as it appeared and didn't have to do with a $
conflict. From the OP:
The error was bombing on
test.replace
because the object that was passed in was already deserialized so the methodreplace
was not found. I guess upgrading to JQuery 1.4.1 had some changes in the way the result object is handled on the success event of the$.ajax
function.