Einhugur Serialization Framework for Xojo

JSONSerializer Class

A class to serialize complex class structures to JSON with almost no coding needed.

Object
   JSONSerializer

class JSONSerializer

Constructors

JSONSerializerA constructor with no parameters for the JSONSerializer class.

Properties

ThrowIfMissingPropertySet this property to true if you want to throw exceptions on missing properties when deserializing.

Methods

AddKnownClassAdds known classes which is required when de-serializing polymorphic structures
DeSerializeDe-serialize's a class structure. (This variation allows for setting default text encoding to be set on read string properties)
DeSerializeDe-serialize's a class structure
SerializeSerialize's a class structure

Examples

You can fine tune your serialized data with the following attributes:

SerializeIgnore

Tells the serialiser to ignore this property.

Example Usage in the Attribute editor in Xojo:

SerializeIgnore

SerializeRename

Tells the serialiser to rename the property in the serialised data. for example if the Xojo property is called Y then you could serialize it as YCoord.

Example Usage in the Attribute editor in Xojo:

SerializeRename "YCoord"

SerializeArrayElementName

Defines a element name in the XML for array elements for the given property if this Attribute is not used then the element name will be Value.

Example Usage in the Attribute editor in Xojo:

SerializeArrayElementName "Employee"

SerializeOrder

Defines the order of the serialisation for the given property.

Example Usage in the Attribute editor in Xojo:

SerializeOrder 2

SerializeRequired

Attribute that can optionally be put on class properties. If class property has this and the property is missing when deserialising then exception is thrown regardless of value of the ThrowIfMissingProperty.

Example Usage in the Attribute editor in Xojo:

SerializeRequired

SerializeClassInfo

Attribute that can optionally be put on object type class properties. If it is set then the property will include extra class info in the serialised data to support polymorphism. (If for example the Property is Node as Object then with extra class info enabled the class value put in it can still work even if its of type of Subclass of the object).

Example Usage in the Attribute editor in Xojo:

SerializeClassInfo

Supported Platforms:

  • MacOS X Carbon
  • MacOS X Cocoa
  • Win32 - Windows
  • Linux x86

    Unsupported Platforms: