Lines Matching refs:JSON

46 assertTrue(Object.prototype === JSON.__proto__);
47 assertEquals("[object JSON]", Object.prototype.toString.call(JSON));
92 assertEquals({}, JSON.parse("{}"));
93 assertEquals({42:37}, JSON.parse('{"42":37}'));
94 assertEquals(null, JSON.parse("null"));
95 assertEquals(true, JSON.parse("true"));
96 assertEquals(false, JSON.parse("false"));
97 assertEquals("foo", JSON.parse('"foo"'));
98 assertEquals("f\no", JSON.parse('"f\\no"'));
100 JSON.parse('"\\b\\f\\n\\r\\t\\"\\u2028\\/\\\\"'));
101 assertEquals([1.1], JSON.parse("[1.1]"));
102 assertEquals([1], JSON.parse("[1.0]"));
104 assertEquals(0, JSON.parse("0"));
105 assertEquals(1, JSON.parse("1"));
106 assertEquals(0.1, JSON.parse("0.1"));
107 assertEquals(1.1, JSON.parse("1.1"));
108 assertEquals(1.1, JSON.parse("1.100000"));
109 assertEquals(1.111111, JSON.parse("1.111111"));
110 assertEquals(-0, JSON.parse("-0"));
111 assertEquals(-1, JSON.parse("-1"));
112 assertEquals(-0.1, JSON.parse("-0.1"));
113 assertEquals(-1.1, JSON.parse("-1.1"));
114 assertEquals(-1.1, JSON.parse("-1.100000"));
115 assertEquals(-1.111111, JSON.parse("-1.111111"));
116 assertEquals(11, JSON.parse("1.1e1"));
117 assertEquals(11, JSON.parse("1.1e+1"));
118 assertEquals(0.11, JSON.parse("1.1e-1"));
119 assertEquals(11, JSON.parse("1.1E1"));
120 assertEquals(11, JSON.parse("1.1E+1"));
121 assertEquals(0.11, JSON.parse("1.1E-1"));
123 assertEquals([], JSON.parse("[]"));
124 assertEquals([1], JSON.parse("[1]"));
125 assertEquals([1, "2", true, null], JSON.parse('[1, "2", true, null]'));
127 assertEquals("", JSON.parse('""'));
128 assertEquals(["", "", -0, ""], JSON.parse('[ "" , "" , -0, ""]'));
129 assertEquals("", JSON.parse('""'));
140 assertEquals({'x': 1, 'y': 2}, JSON.parse(pointJson));
141 assertEquals({'x': 1}, JSON.parse(pointJson, GetFilter('y')));
142 assertEquals({'y': 2}, JSON.parse(pointJson, GetFilter('x')));
144 assertEquals([1, 2, 3], JSON.parse("[1, 2, 3]"));
146 var array1 = JSON.parse("[1, 2, 3]", GetFilter(1));
150 var array2 = JSON.parse("[1, 2, 3]", GetFilter(2));
160 JSON.parse(deepObject));
162 JSON.parse(deepObject, DoubleNumbers));
165 assertThrows(function () { JSON.parse(str); }, SyntaxError);
236 assertEquals(expected, JSON.stringify(input));
237 assertEquals(expected, JSON.stringify(input, null, 0));
257 assertEquals("[\n 1,\n 2,\n 3\n]", JSON.stringify([1, 2, 3], null, 1));
258 assertEquals("[\n 1,\n 2,\n 3\n]", JSON.stringify([1, 2, 3], null, 2));
260 JSON.stringify([1, 2, 3], null, new Number(2)));
261 assertEquals("[\n^1,\n^2,\n^3\n]", JSON.stringify([1, 2, 3], null, "^"));
263 JSON.stringify([1, 2, 3], null, new String("^")));
265 JSON.stringify([1, 2, [3, [4], 5], 6, 7], null, 1));
266 assertEquals("[]", JSON.stringify([], null, 1));
268 JSON.stringify([1, 2, [3, [4], 5], 6, 7], null));
270 JSON.stringify([1, 2, [3, [4], 5], 6, 7], DoubleNumbers));
284 JSON.stringify({ get getter() { counter++; return 123; } }));
287 JSON.stringify({ get getter() { counter++; return 123; } },
316 assertThrows(function () { JSON.stringify(circular); }, TypeError);
317 assertThrows(function () { JSON.stringify(circular, null, 0); }, TypeError);
324 assertEquals('{"x":5}', JSON.stringify({x:5,y:6}, ['x']));
326 JSON.stringify({a:"b",c:"d"}, null, 1));
327 assertEquals('{"y":6,"x":5}', JSON.stringify({x:5,y:6}, ['y', 'x']));
337 JSON.stringify({a:"b",c:"d"}, null,
342 JSON.stringify({a:"b",c:"d"}, null, 15));
346 assertEquals('{"x":"42"}', JSON.stringify({x: String}, newx));
347 assertEquals('{"x":42}', JSON.stringify({x: Number}, newx));
348 assertEquals('{"x":true}', JSON.stringify({x: Boolean}, newx));
359 JSON.stringify({a: undefined, b: function(){}, c: 42, d: 42},
372 assertEquals(42, JSON.parse(o));
377 var encoded = JSON.stringify(string);
473 var o1 = JSON.parse('{"__proto__":[]}');
482 var o2 = JSON.parse('{"__proto__":5}');
491 TestStringify(json, JSON.parse(json));
502 assertEquals({a: 0, b: {x: null}}, JSON.parse('{"a":0,"b":1}', reviver));
511 assertEquals({a: 0, b: 1}, JSON.parse('{"a":0,"b":1}', reviver));
520 assertEquals({a: 0, b: 1}, JSON.parse('{"a":0,"b":1}', reviver));