|
Project Information
Featured
Downloads
|
A fast non-strict (as in loose, not lazy) Flash JSON parser implementation. It takes advantage of the ArrayElementType metadata tag and the flash.utils.describeType method (calls to which are cached) to provide a typed parser, and uses Adobe Alchemy to ensure speed (at least twice as fast, but generally around four times the speed of as3corelib's implementation). The interface closely follows as3corelib's, with some minor extensions: com.rational.serialization.json.JSON.encode(o:*):String delegates to the as3corelib implementation. com.rational.serialization.json.JSON.decode(s:String, type:Class=null):* will use an untyped version if the second argument is left off (or null) or a typed version if it is included. The typed version behaves in most cases as expected, and relies on the ArrayElementType tag to give the expected contents of an array property. If the first argument represents a top-level object, then the second argument defines the object's type. If the first argument represents a top-level array, then the second argument defines the array element type. Speed differences for shallow objects between typed and untyped versions are relatively minimal (< 10%). Deep object structures may experience a greater difference. To build the project from source, ensure the following are installed:
To build: scons or scons --strict This will produce a library json.swc. scons --test or scons --test --strict will produce an executable (./bson ?-f input? ?-o output?) for testing. It is best used by piping the output to hexdump -C. scons --update will sync the JSONEncoder and unit tests with the as3corelib repository. |