This class provides encoding and decoding of the JSON format.
Example usage:
// create a JSON string from an internal object
JSON.encode( myObject );
// read a JSON string into an internal object
var myObject:Object = JSON.decode( jsonString );
public static function decode(s:String, strict:Boolean = true):*
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 9.0 |
Decodes a JSON string into a native object.
Parameters
| s:String — The JSON string representing the object
|
|
| strict:Boolean (default = true ) — Flag indicating if the decoder should strictly adhere
to the JSON standard or not. The default of true
throws errors if the format does not match the JSON syntax exactly.
Pass false to allow for non-properly-formatted JSON
strings to be decoded with more leniancy.
|
Returns | * — A native object as specified by s
|
public static function encode(o:Object):String
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 9.0 |
Encodes a object into a JSON string.
Parameters
| o:Object — The object to create a JSON string for
|
Returns | String — the JSON string representing o
|
Thu Feb 9 2012, 01:25 PM -08:00