Skip to content
avoidwork edited this page Apr 24, 2012 · 1 revision

json

Symantec wrappers for native JSON methods.

var obj = $.decode("[{\"abc\":true}]");

json.decode

Method

Decodes the stringified JSON argument

@param  {String}  arg     String to parse
@param  {Boolean} silent  [Optional] Silently fail
@return {Mixed} Entity resulting from parsing JSON, or undefined

Example

var result = $.json.decode("{\"prop\":\"value\"}");

json.encode

Method

Encodes the argument as JSON

@param  {Mixed}   arg    Entity to encode
@param  {Boolean} silent [Optional] Silently fail
@return {String} JSON, or undefined

Example

var result = $.json.encode([1,2,3,4,5]);