libmir / mir-ion

Ion, JSON, YAML, CSV, CBOR and Msgpack serialization framework
Apache License 2.0
14 stars 6 forks source link

implementing custom (de)serializer guide #26

Closed WebFreak001 closed 1 year ago

WebFreak001 commented 2 years ago

I think mir-ion is a great base for (de)serializers, as it already includes a few formats I think it would be interesting for users to know how to extend it to add their own ones.

9il commented 2 years ago

For serialization a serialiser structure should be implemented to satisfy the interface wrapper in mir.ser.interfaces. The serialiser can throw in case of unexpected types of input data. This user serialization type can be used directly with mir.ser.serializeValue function.

The deserialization is done through conversion to binary ion data. For example, handleMsgPackElement serialise the msgpack input to an ion serialiser. Then deserializeIon can be used to deserialise data.