public class Serializer { private PropertyTable _propertyTable; private DateTimeFormat _dateFormat; public Serializer() { _dateFormat = DateTimeFormat.ISO8601; _propertyTable = new PropertyTable(); } /// /// Gets/Sets the format that will be used to display /// and parse dates in the Json data. /// public DateTimeFormat DateFormat { get { return _dateFormat; } set { _dateFormat = value; } } /// /// Serializes an object into a Json string. /// /// /// public string Serialize(object o) { return JsonPrimitives.Serialize(o); } /// /// Desrializes a Json string into an object. /// /// /// public object Deserialize(string json) { Hashtable table = JsonParser.JsonDecode(json) as Hashtable; JsonPrimitives.DumpObjects(table, 0); return _propertyTable.FindObject(table); } /// /// Resets the contents of the Property Table with current classes and property definitions. /// This does NOT need to be called when values change, only when new classes are /// loaded dynamically at runtime. /// public void Snapshot() { _propertyTable.Snapshot(); } }