Class CQ.Ext.util.JSON
| Package: | CQ.Ext.util |
| Class: | JSON |
| Extends: | Object |
| Clientlib: | cq.widgets |
Modified version of Douglas Crockford"s json.js that doesn"t
mess with the Object prototype
http://www.json.org/js.html
This class is a singleton and cannot be created directly.
Public Properties
This class has no public properties.
Public Methods
| |
decode( String json ) : Object
Decodes (parses) a JSON string to an object. If the JSON is invalid, this function throws a SyntaxError unless the sa...
Decodes (parses) a JSON string to an object. If the JSON is invalid, this function throws a SyntaxError unless the safe option is set.
Parameters:
json : StringThe JSON string
Returns:
ObjectThe resulting object
|
JSON |
| |
encode( Mixed o ) : String
Encodes an Object, Array or other value
Encodes an Object, Array or other value
Parameters:
o : MixedThe variable to encode
Returns:
|
JSON |
| |
encodeDate( Date d ) : String
Encodes a Date. This returns the actual string which is inserted into the JSON string as the literal expression.
The ...
Encodes a Date. This returns the actual string which is inserted into the JSON string as the literal expression.
The returned value includes enclosing double quotation marks.
The default return format is "yyyy-mm-ddThh:mm:ss".
To override this: CQ.Ext.util.JSON.encodeDate = function(d) {
return d.format('"Y-m-d"');
};
Parameters:
d : DateThe Date to encode
Returns:
|
JSON |
Public Events
This class has no public events.