JSON reviver option
JSON reviver option
Hi, any chance we could add a reviver option to the ajax settings for
JSON requests?
This could also be used by other plugins that parse JSON data too.
- Mark
Index: src/ajax.js
===================================================================
--- src/ajax.js (revision 6529)
+++ src/ajax.js (working copy)
@@ -182,7 +182,8 @@
json: "application/json, text/javascript",
text: "text/plain",
_default: "*/*"
- }
+ },
+ jsonReviver: null
},
// Last-Modified header cache for next request
@@ -565,7 +566,7 @@
// Get the JavaScript object, if JSON is used.
if ( type === "json" ) {
if ( typeof JSON === "object" && JSON.parse ) {
- data = JSON.parse( data );
+ data = JSON.parse( data, s.jsonReviver );
} else {
data = (new Function("return " + data))();
}