JSON
Module | ejs |
Definition | final class JSON |
Inheritance | JSON ![]() |
Stability | Evolving. |
JavaScript Object Notation.
This class supports the JSON data exchange format as described by: RFC 4627 at (http://www.ietf.org/rfc/rfc4627.txt).
Properties
Qualifiers | Property | Type | Description |
---|---|---|---|
No properties defined |
JSON Methods
Qualifiers | Method |
---|---|
public static | parse(data: String, filter: Function = null): Object |
Parse a string JSON representation and return an object equivalent. | |
public static | stringify(obj: Object, replacer: Object = null , indent: Number = 0): String |
Convert an object into a string JSON representation. |
Method Detail
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. NOTE: the filter function is not yet implemented. [default: null]
- Returns
- An object representing the JSON string.
Convert an object into a string JSON representation.
- Parameters
obj: Object Object to stringify. replacer: Object An optional parameter that determines how object values are stringified for objects without a toJSON method. It can be a function or an array. NOTE: Not implemented. indent: Number 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. NOTE: Not implemented.
- Returns
- A JSON string representing the object.