Child pages
  • JSON

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Div
styledisplay:none

DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY (EXCEPT INSIDE THE DIV BELOW WITH ID=DESCRIPTION), UNLESS YOU KNOW WHAT YOU'RE DOING.
THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO AUTO UPDATE THE CONTENT THROUGH THE DOC GENERATOR.

Enter additional information related to this 'class' inside the {div} macro with 'id=description'

Div
iddescription



HTML Table
id
classservoy sSummary
Colgroup Tag
Col
width80px
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Summary
Table Row (tr)
Table Cell (td)
Object
Table Cell (td)
parse(text)
Parses a string as JSON and returns the parsed value.
Table Row (tr)
Table Cell (td)
Object
Table Cell (td)
parse(text, reviver)
Parses a string as JSON and returns the parsed value.
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
stringify(value)
Convert a value to JSON, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
stringify(value, replacer)
Convert a value to JSON, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified.
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
stringify(value, replacer, space)
Convert a value to JSON, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified.
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
stringify(value, replacer, space)
Convert a value to JSON, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified.
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
stringify(value, replacer)
Convert a value to JSON, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified.
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
stringify(value, replacer, space)
Convert a value to JSON, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified.
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
stringify(value, replacer, space)
Convert a value to JSON, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified.
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
stringify(value, replacer)
Convert a value to JSON, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified.
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
stringify(value, replacer, space)
Convert a value to JSON, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified.
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
stringify(value, replacer, space)
Convert a value to JSON, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified.



HTML Table
idfunction
classservoy sDetail
Colgroup Tag
Col
colspan2
width100%
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Details
Table Body (tbody)
idparse-String
Table Row (tr)
idname
Table Cell (td)

parse

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Object
Span
stylefont-weight: bold;
parse
Span
(text)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Parses a string as JSON and returns the parsed value.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{String} text - The string to parse as JSON. See the JSON object for a description of JSON syntax.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Object
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
JSON.parse('[1, 5, "false"]');
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idparse-String_Function
Table Row (tr)
idname
Table Cell (td)

parse

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Object
Span
stylefont-weight: bold;
parse
Span
(text, reviver)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Parses a string as JSON and returns the parsed value.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{String} text - The string to parse as JSON. See the JSON object for a description of JSON syntax.
{Function} reviver - A function, prescribes how the value originally produced by parsing is transformed, before being returned.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Object
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
var transformed = JSON.parse('{"p": 5}', function(k, v) { if (k === "") return v; return v * 2; });
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idstringify-Object
Table Row (tr)
idname
Table Cell (td)

stringify

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
stringify
Span
(value)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Convert a value to JSON, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Object} value - The value to convert to a JSON string.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
JSON.stringify([1, "false", false])
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idstringify-Object_Function
Table Row (tr)
idname
Table Cell (td)

stringify

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
stringify
Span
(value, replacer)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Convert a value to JSON, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified.
As a function, the replacer takes two parameters, the key and the value being stringified. Initially it gets called with an empty key representing the object being stringified,
and it then gets called for each property on the object or array being stringified.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Object} value - The value to convert to a JSON string.
{Function} replacer - If a function, transforms values and properties encountered while stringifying; if an array (of String or Number), specifies the set of properties included in objects in the final string.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
function censor(key, value) {
 if (typeof(value) == "string") {
   return undefined;
 }
 return value;
}

var foo = {foundation: "Mozilla", model: "box", week: 45, transport: "car", month: 7};
var jsonString = JSON.stringify(foo, censor);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idstringify-Object_Function_Number
Table Row (tr)
idname
Table Cell (td)

stringify

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
stringify
Span
(value, replacer, space)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Convert a value to JSON, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified.
As a function, the replacer takes two parameters, the key and the value being stringified. Initially it gets called with an empty key representing the object being stringified,
and it then gets called for each property on the object or array being stringified.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Object} value - The value to convert to a JSON string.
{Function} replacer - If a function, transforms values and properties encountered while stringifying; if an array (of String or Number), specifies the set of properties included in objects in the final string.
{Number} space - The space argument may be used to control spacing in the final string (causes the resulting string to be pretty-printed). If it is a number, successive levels in the stringification will each be indented by this many space characters (up to 10). If it is a string, successive levels will indented by this string (or the first ten characters of it).
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
JSON.stringify({ uno: 1, dos : 2 }, null, '\t')
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idstringify-Object_Function_String
Table Row (tr)
idname
Table Cell (td)

stringify

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
stringify
Span
(value, replacer, space)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Convert a value to JSON, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified.
As a function, the replacer takes two parameters, the key and the value being stringified. Initially it gets called with an empty key representing the object being stringified,
and it then gets called for each property on the object or array being stringified.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Object} value - The value to convert to a JSON string.
{Function} replacer - If a function, transforms values and properties encountered while stringifying; if an array (of String or Number), specifies the set of properties included in objects in the final string.
{String} space - The space argument may be used to control spacing in the final string (causes the resulting string to be pretty-printed). If it is a number, successive levels in the stringification will each be indented by this many space characters (up to 10). If it is a string, successive levels will indented by this string (or the first ten characters of it).
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
JSON.stringify({ uno: 1, dos : 2 }, null, '\t')
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idstringify-Object_NumberArray
Table Row (tr)
idname
Table Cell (td)

stringify

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
stringify
Span
(value, replacer)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Convert a value to JSON, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified.
As a function, the replacer takes two parameters, the key and the value being stringified. Initially it gets called with an empty key representing the object being stringified,
and it then gets called for each property on the object or array being stringified.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Object} value - The value to convert to a JSON string.
{Number[]} replacer - If a function, transforms values and properties encountered while stringifying; if an array (of String or Number), specifies the set of properties included in objects in the final string.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
function censor(key, value) {
 if (typeof(value) == "string") {
   return undefined;
 }
 return value;
}

var foo = {foundation: "Mozilla", model: "box", week: 45, transport: "car", month: 7};
var jsonString = JSON.stringify(foo, censor);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idstringify-Object_NumberArray_Number
Table Row (tr)
idname
Table Cell (td)

stringify

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
stringify
Span
(value, replacer, space)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Convert a value to JSON, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified.
As a function, the replacer takes two parameters, the key and the value being stringified. Initially it gets called with an empty key representing the object being stringified,
and it then gets called for each property on the object or array being stringified.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Object} value - The value to convert to a JSON string.
{Number[]} replacer - If a function, transforms values and properties encountered while stringifying; if an array (of String or Number), specifies the set of properties included in objects in the final string.
{Number} space - The space argument may be used to control spacing in the final string (causes the resulting string to be pretty-printed). If it is a number, successive levels in the stringification will each be indented by this many space characters (up to 10). If it is a string, successive levels will indented by this string (or the first ten characters of it).
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
JSON.stringify({ uno: 1, dos : 2 }, null, '\t')
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idstringify-Object_NumberArray_String
Table Row (tr)
idname
Table Cell (td)

stringify

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
stringify
Span
(value, replacer, space)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Convert a value to JSON, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified.
As a function, the replacer takes two parameters, the key and the value being stringified. Initially it gets called with an empty key representing the object being stringified,
and it then gets called for each property on the object or array being stringified.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Object} value - The value to convert to a JSON string.
{Number[]} replacer - If a function, transforms values and properties encountered while stringifying; if an array (of String or Number), specifies the set of properties included in objects in the final string.
{String} space - The space argument may be used to control spacing in the final string (causes the resulting string to be pretty-printed). If it is a number, successive levels in the stringification will each be indented by this many space characters (up to 10). If it is a string, successive levels will indented by this string (or the first ten characters of it).
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
JSON.stringify({ uno: 1, dos : 2 }, null, '\t')
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idstringify-Object_StringArray
Table Row (tr)
idname
Table Cell (td)

stringify

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
stringify
Span
(value, replacer)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Convert a value to JSON, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified.
As a function, the replacer takes two parameters, the key and the value being stringified. Initially it gets called with an empty key representing the object being stringified,
and it then gets called for each property on the object or array being stringified.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Object} value - The value to convert to a JSON string.
{String[]} replacer - If a function, transforms values and properties encountered while stringifying; if an array (of String or Number), specifies the set of properties included in objects in the final string.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
function censor(key, value) {
 if (typeof(value) == "string") {
   return undefined;
 }
 return value;
}

var foo = {foundation: "Mozilla", model: "box", week: 45, transport: "car", month: 7};
var jsonString = JSON.stringify(foo, censor);
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idstringify-Object_StringArray_Number
Table Row (tr)
idname
Table Cell (td)

stringify

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
stringify
Span
(value, replacer, space)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Convert a value to JSON, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified.
As a function, the replacer takes two parameters, the key and the value being stringified. Initially it gets called with an empty key representing the object being stringified,
and it then gets called for each property on the object or array being stringified.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Object} value - The value to convert to a JSON string.
{String[]} replacer - If a function, transforms values and properties encountered while stringifying; if an array (of String or Number), specifies the set of properties included in objects in the final string.
{Number} space - The space argument may be used to control spacing in the final string (causes the resulting string to be pretty-printed). If it is a number, successive levels in the stringification will each be indented by this many space characters (up to 10). If it is a string, successive levels will indented by this string (or the first ten characters of it).
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
JSON.stringify({ uno: 1, dos : 2 }, null, '\t')
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idstringify-Object_StringArray_String
Table Row (tr)
idname
Table Cell (td)

stringify

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
stringify
Span
(value, replacer, space)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Convert a value to JSON, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified.
As a function, the replacer takes two parameters, the key and the value being stringified. Initially it gets called with an empty key representing the object being stringified,
and it then gets called for each property on the object or array being stringified.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Object} value - The value to convert to a JSON string.
{String[]} replacer - If a function, transforms values and properties encountered while stringifying; if an array (of String or Number), specifies the set of properties included in objects in the final string.
{String} space - The space argument may be used to control spacing in the final string (causes the resulting string to be pretty-printed). If it is a number, successive levels in the stringification will each be indented by this many space characters (up to 10). If it is a string, successive levels will indented by this string (or the first ten characters of it).
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
JSON.stringify({ uno: 1, dos : 2 }, null, '\t')
Table Row (tr)
classlastDetailRow
Table Cell (td)