PackageDescription: Json-ObjectMapping

Json - Object Mapping

Last published: August 22, 2008 by 'mlucassmith'

Defines 0 Classes
Extends 0 Classes

This package allows you to re-interpret JSON {} hashes as Smalltalk objects. A special property is written out when an Object is serialized, _class - which serializing a regular object, not a Json-like object (dictionary, keyed, collections, strings, numbers, etc).

Once you've read back an object from a JSON stream, you can send it #jsonToObject and it will map back from the properties in to an object class. If the class doesn't exist, you keep the Dictionary. If the dictionary doesn't include the _class property, you also keep the dictionary.

To use, you can call:
JSON.JsonReader read: aStream -- this will read from a json stream and create objects from the resulting dictionary/array
JSON.JsonReader render: anObject -- this will write out a json stream as a string from any object, including regular objects