Module puredom.json
-
Parse and generate JSON. When called as a function,
puredom.json()automatically converts between JSON-Strings and Objects. - Defined in: utils.js
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
puredom.json(what)
|
Method Summary
| Method Attributes | Method Name and Description |
|---|---|
| <static> |
puredom.json.
parse
(json)
Parse JSON from a {String} and return the resulting object.
|
| <static> |
puredom.json.
stringify
(what)
Serialize a JavaScript object structure to a JSON string.
|
Module Detail
puredom.json(what)
- Parameters:
- {String|Object|Array} what
- If a String is passed, it is parsed as JSON. Otherwise, returns JSON-encoded value of
what.
- Returns:
- {String|Object|Array} jsonStringOrJsonResult
Method Detail
-
<static> {Object|Array|String|Number} puredom.json.parse(json)Parse JSON from a {String} and return the resulting object.
var obj = puredom.json.parse('{"items":[{"title":"Example"}]}');- Parameters:
- {String} json
- A string containing JSON.
- Returns:
- {Object|Array|String|Number} jsonResult
-
<static> {String} puredom.json.stringify(what)Serialize a JavaScript object structure to a JSON string.
Note: Circular references cause this function to fail.- Parameters:
- {Any}what
- Any object of any type.
- Returns:
- {String} The JSON-encoded string