We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d7d753f commit 5394740Copy full SHA for 5394740
jquery.json.js
@@ -80,7 +80,7 @@
80
{
81
var ret = [];
82
for (var i = 0; i < o.length; i++)
83
- ret.push( $.toJSON(o[i]) );
+ ret.push( $.toJSON(o[i]) || "null" );
84
85
return "[" + ret.join(",") + "]";
86
}
jquery.json.test.js
@@ -30,7 +30,6 @@ function _test(o, correct)
30
31
// 'console' comes from FireBug
32
function testJSON(o, expected) {
33
- _test(o, expected);
34
try { _test(o, expected); }
35
catch (e) { console.error("Conversion Error:", e.message) }
36
@@ -56,6 +55,13 @@ testJSON([2, 5], "[2,5]");
56
55
testJSON(function() {}, undefined);
57
58
testJSON(null, "null");
+testJSON(["C:\\A.TXT","C:\\B.TXT","C:\\C.TXT","C:\\D.TXT"], '["C:\\\\A.TXT","C:\\\\B.TXT","C:\\\\C.TXT","C:\\\\D.TXT"]');
59
+testJSON({"dDefault": "1.84467440737E+19"}, '{"dDefault":"1.84467440737E+19"}');
60
+testJSON([undefined, undefined, 1, 2], '[null,null,1,2]');
61
+testJSON([0, false, function() {}], '[0,false,null]');
62
+testJSON(0, '0');
63
+testJSON(false, 'false');
64
+testJSON(null, 'null');
65
testJSON(new Date(2008, 9, 25), '"2008-10-25T05:00:00.000Z"');
66
67
// Temporarily remove Date's toJSON and JSON.stringify
0 commit comments