EncodeKit is a Xojo module for encoding and decoding objects for storage and transmission using JSON.
EncodeKit exposes two classes:
JSONDecoder which are capable of serialising and deserialising almost any Xojo class with little or no input from you.
Firstly, drop the
EncodeKit module into your project.
Before you can encode a custom class, you must first register it with
EncodeKit. There is no need to register Xojo primitives or other common built-in classes such as
DateTime as they are handled internally.
To register a class called
To encode an instance of
Var encoder As New EncodeKit.JSONEncoder
Var c1 As New MyClass
Var json As String = encoder.Encode(c1)
To decode an instance of
Var decoder As New EncodeKit.JSONDecoder
Var c1 As MyClass = decoder.Decode(json)
This is essentially a modern port of Kem Tekinay's proof-of-concept Serializer_MTC class.
EncodeKit differs from that project in the following ways:
Separate encoder and decoder classes.
Removed all references to
Removed the need for
Removed support for
Added support for