Writing a data format

The most important thing to understand before writing a data format is that Serde is not a parsing library. Nothing in Serde is going to help you parse whatever format you are implementing. The role of Serde is very specific:

  • Serialization — taking arbitrary data structures from the user and rendering them in the format with maximum efficiency.
  • Deserialization — interpreting the data that you parse into data structures of the user's choice with maximum efficiency.

Parsing is neither of these things and you will either be writing parsing code from scratch or using a parsing library to implement your Deserializer.

The second most important thing to understand is the Serde data model.

The following pages walk through a basic but functional JSON serializer and deserializer implemented using Serde.