Ext JS 3.4.0 Sencha Docs

Ext.util.JSON

Files

Modified version of Douglas Crockford"s json.js that doesn"t mess with the Object prototype http://www.json.org/js.html

Available since: 1.1.0

Defined By

Methods

Ext.util.JSON
view source
( json ) : Object
Decodes (parses) a JSON string to an object. ...

Decodes (parses) a JSON string to an object. If the JSON is invalid, this function throws a SyntaxError unless the safe option is set.

Available since: 1.1.0

Parameters

Returns

  • Object

    The resulting object

Ext.util.JSON
view source
( o ) : String
Encodes an Object, Array or other value ...

Encodes an Object, Array or other value

Available since: 1.1.0

Parameters

  • o : Mixed

    The variable to encode

Returns

Ext.util.JSON
view source
( d ) : String
Encodes a Date. ...

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:

Ext.util.JSON.encodeDate = function(d) {
    return d.format('"Y-m-d"');
};

Available since: Ext JS 3.4.0

Parameters

  • d : Date

    The Date to encode

Returns

  • String

    The string literal to use in a JSON string.