Home | History | Annotate | Download | only in resources

Lines Matching full:value

14         JSON.stringify(value, replacer, space)
15 value any JavaScript value, usually an object or array.
28 This method produces a JSON text from a JavaScript value.
30 When an object value is found, if the object contains a toJSON
33 value represented by the name/value pair that should be serialized,
35 will be passed the key associated with the value, and this will be
55 key and value of each member, with this bound to the containing
56 object. The value that is returned from your method will be
72 value that is filled with line breaks and indentation to make it
88 text = JSON.stringify([new Date()], function (key, value) {
90 'Date(' + this[key] + ')' : value;
101 and its return value is used instead of the original value.
110 myData = JSON.parse(text, function (key, value) {
112 if (typeof value === 'string') {
114 /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
120 return value;
123 myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
125 if (typeof value === 'string' &&
126 value.slice(0, 5) === 'Date(' &&
127 value.slice(-1) === ')') {
128 d = new Date(value.slice(5, -1));
133 return value;
224 v, // The member value.
228 value = holder[key];
230 // If the value has a toJSON method, call it to obtain a replacement value.
232 if (value && typeof value === 'object' &&
233 typeof value.toJSON === 'function') {
234 value = value.toJSON(key);
238 // obtain a replacement value.
241 value = rep.call(holder, key, value);
244 // What happens next depends on the value's type.
246 if (value && ((typeof value) === "object")) {
247 if (value.constructor === String || value.constructor === Number || value.constructor === Boolean)
248 value = value.valueOf();
251 switch (typeof value) {
253 return quote(value);
259 return isFinite(value) ? String(value) : 'null';
264 // If the value is a boolean or null, convert it to a string. Note:
268 return String(value);
278 if (!value) {
282 // Make an array to hold the partial results of stringifying this object value.
287 // Is the value an array?
289 if (Object.prototype.toString.apply(value) === '[object Array]') {
291 // The value is an array. Stringify every element. Use null as a placeholder
294 length = value.length;
296 partial[i] = str(i, value) || 'null';
318 v = str(k, value);
328 for (k in value) {
329 if (Object.hasOwnProperty.call(value, k)) {
330 v = str(k, value);
352 JSON.stringify = function (value, replacer, space) {
354 // The stringify method takes a value and an optional replacer, and an optional
388 // Make a fake root object containing our value under the key of ''.
389 // Return the result of stringifying the value.
391 return str('', {'': value});
402 // a JavaScript value if the text is a valid JSON text.
411 var k, v, value = holder[key];
412 if (value && typeof value === 'object') {
413 for (k in value) {
414 if (Object.hasOwnProperty.call(value, k)) {
415 v = walk(value, k);
417 value[k] = v;
419 delete value[k];
424 return reviver.call(holder, key, value);
448 // replace all simple value tokens with ']' characters. Third, we delete all
466 // each name/value pair to a reviver function for possible transformation.