The JSON namespace provides functions for converting Mildew Objects into JSON strings, or JSON strings
into Mildew Objects. Mildew Objects can be retrieved and sent across the internet through XMLHttpRequest
and REST APIs.
Methods
(static) parse(string) → {*}
Converts a JSON string into a Mildew value. If the string is not valid JSON, throws an error.
Parameters:
Name | Type | Description |
---|---|---|
string |
String | Any valid JSON string |
Returns:
A Mildew Object described by the JSON string if successfully parsed.
- Type
- *
(static) stringify(object, replacer) → {String}
Converts a Mildew object into a valid JSON string. Invalid JSON values such as Function are ignored
unless the replacer method overrides this. Native D objects with no added fields will produce "{}" as
the value.
Parameters:
Name | Type | Description |
---|---|---|
object |
* | Any Mildew Object |
replacer |
function | A callback that receives the key and value of each Object entry and returns a String to be used as the value in the conversion. This method works differently than Node.js. |
Returns:
A JSON string representation of the Object.
- Type
- String