Argonaut is an AS3/JSON serializer/deserializer. It provides a simple way for client applications to share classes with servers through JSON. The task of converting JSON data into instantiated objects is tedious and error-prone, and can be difficult if the JSON file has deeply nested elements. Argonaut bypasses all this hand-tooling by automating the process.
It uses reflection to analyze mapped classes and can use these mappings to infer a lot of information about the JSON it’s processing. For example, if the mapped AS class uses a typed Vector to store the JSON array of a class, Argonaut knows to manufacture that class from the JSON array. It understands all common JSON data types (
Null) and can also interpret JSON as custom classes or even core Actionscript classes (e.g.,
BitmapData). Additionally, Argonaut allows the JSON to provide deterministic mappings to remove any guessing.
var argonaut:Argonaut = new Argonaut(); argonaut.registerClassAlias(“com.example.EpicGalley”, EpicGalley); argonaut.registerClassAlias("com.example.Hero", Hero); var galley:EpicGalley = argonaut.generate(json); // or using an explicit class var galley:EpicGalley = argonaut.generateAs(json, EpicGalley);