JSON
Module | ejs |
Definition | final class JSON |
Inheritance | JSON ![]() |
Stability | Evolving. |
Encoding and decoding to JavaScript Object Notation strings (JSON).
This class supports the JSON data exchange format as described by: RFC 4627 at (http://www.ietf.org/rfc/rfc4627.txt).
Properties
(No own properties defined)
JSON Class Methods
Qualifiers | Method |
---|---|
static | parse(data: String, filter: Function = null): Object |
Parse a string JSON representation and return an object equivalent. | |
static | stringify(obj: Object, replacer: Object = null, indent: Object = null): String |
Convert an object into a string JSON representation. |
JSON Instance Methods
Qualifiers | Method |
---|
Method Detail
- Description
- Parse a string JSON representation and return an object equivalent.
- Parameters
data: String JSON string data to parse. filter: Function The optional filter parameter is 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. The filter function is invoked with the following signature: function filter(key: String, value: Object): Object NOTE: the filter function is not yet implemented. [default: null]
- Returns
- An object representing the JSON string.
- Description
- Convert an object into a string JSON representation.
- Parameters
obj: Object Object to stringify. replacer: Object An optional function that determines how object values are stringified for objects without a toJSON method. The replace has the following signature: function replacer(key: String, value: String): String. [default: null] indent: Object Optional parameter for the level of indentation of nested structures. If omitted, the text will be packed without whitespace. If a number, it specifies the number of spaces to indent at each level. If a string, it contains the characters used to indent at each level. NOTE: The indent argument is not yet implemented. [default: null]
- Returns
- A JSON string representing the object.