Namespace JSON
- Defined in: JSON.js
Constructor Attributes | Constructor Name and Description |
---|---|
Method Summary
Method Attributes | Method Name and Description |
---|---|
<static> |
JSON.pad(callback, data)
Create a JSONP-compatible response from the callback name and the desired data.
|
<static> |
JSON.parse(text, reviver)
This method parses a JSON text to produce an object or array.
|
<static> |
JSON.sendPaddedResponse(data, key, resume)
Send a JSONP-compatible response if a the request contains callback data.
|
<static> |
JSON.stringify(value, replacer, space)
This method produces a JSON text from a JavaScript value.
|
Namespace Detail
JSON
Method Detail
-
<static> JSON.pad(callback, data)Create a JSONP-compatible response from the callback name and the desired data.
- Parameters:
- {String} callback
- The name of the JSONP callback method
- {Object} data
- An arbitrary JavaScript object
-
<static> {Object} JSON.parse(text, reviver)This method parses a JSON text to produce an object or array.
- Parameters:
- {String} text
- The JSON text.
- {Function} reviver
- A function that can filter and transform the results. It receives each of the keys and values, and its return value is used instead of the original value. If it returns what it received, then the structure is not modified. If it returns undefined then the member is deleted.
- Returns:
- {Object}
-
<static> JSON.sendPaddedResponse(data, key, resume)Send a JSONP-compatible response if a the request contains callback data. This works out-of-the-box with jQuery but can be customized using the key argument.
- Parameters:
- {Object} data
- An arbitrary JavaScript object
- {String} key
- The name of the property in req.data containing the JSONP callback method name
- {Boolean} resume
- Switch to define whether further processing should be continued or not
-
<static> {String} JSON.stringify(value, replacer, space)This method produces a JSON text from a JavaScript value.
- Parameters:
- {Object} value
- Any JavaScript value, usually an object or array.
- {Function|String[]} replacer Optional
- An optional parameter that determines how object values are stringified for objects. It can be a function or an array of strings.
- {String|Number} space Optional
- An optional parameter that specifies the indentation of nested structures. If it is omitted, the text will be packed without extra whitespace. If it is a number, it will specify the number of spaces to indent at each level. If it is a string (such as '\t' or ' '), it contains the characters used to indent at each level.
- Returns:
- {String}