View on GitHub

zserio

zero sugar, zero fat, zero serialization overhead

zero serialization overhead


Zserio is a framework for serializing structured data with a compact and efficient way with low overhead.

You can define your structured data in Zserio language and then you can use special generated source code in several languages to easily write and read your data to and from a binary or a text stream.

No time to read? Go to the quick start or download latest release.

In for the numbers? Head over to benchmarks.

Questions? Check the FAQs.

More documentation? Go to the documentation.


Language support

Zserio supports the following code generators:

In addition to these, Zserio provides specialized text generators for documentation and export

Introduction

The Zserio serialization framework allows you to serialize data in a compact and efficient way.

The key features include

It can be retrofitted on top of almost any other serialization language or model, since it gives the developer powerful low-level access.

It features simple and compound data structures and provides advanced features for controlling at design time what writers will be able to fill in.

Zserio does have a very simple wire format described at Zserio Encoding Guide.

Zserio supports as well serialization and deserialization in JSON format described at Zserio JSON Guide.

Quick Start

To be able to serialize data with Zserio, you have to follow these basic steps:

  1. Download the runtimes and the Zserio compiler from Github Releases
  2. Set up your development environment with the Zserio runtime
  3. Write the schema definition
  4. Compile the schema and generate code
  5. Serialize/deserialize using the generated code

You can find the detailed quick start tutorial in their respective repositories:

Or try Interactive Zserio Compiler based on Streamlit.

Features overview

Documentation

Documentation of the schema language can be found in the Zserio Language Overview.

Schema language reference can be found in Quick Reference.

Explanation how zserio encodes data to the wire format can be found in the Zserio Encoding Guide.

Explanation how zserio encodes data to the JSON format can be found in the Zserio JSON Guide.

Explanation how zserio schema can be extended not to break backward or forward compatibility can be found in the Zserio Schema Evolution Guide.

Explanation how to deal with all possible backward incompatibilities that can occur after updating of Zserio can be found in the Zserio Compatibility Guide.

User Guide can be found in the Zserio Compiler User Guide.

Build instructions can be found in the Zserio Compiler Build Instructions.

C++ users can find more information in the C++ Tutorial.

Java users can find more information in the Java Tutorial.

Python users can find more information in the Python Tutorial.

Check out as well the Zserio Types Mapping for types mapping description.

Extensions

Zserio extension is any Java extension which implements zserio.tools.Extension interface.

For example, if you need to implement a new code generator for Zserio, you need to implement special Zserio extension. Or another example could be a Zserio extension which only prints some schema statistics and it does not generate anything.

Each Zserio extension should be packed in a single jar file.

All Zserio extensions which are available on the Java classpath are automatically loaded during Zserio compiler startup.

More information how to implement a new Zserio extension can be found in the Zserio extension sample.

Services

Service types allow to define generic service interfaces. But note that no underlying communication library is provided by Zserio. Zserio only defines the generic interface and users are responsible for its implementation. However, Zserio provides sample implementations of several services backends:

Pub/Sub

Pubsub types allow to define generic Pub/Sub clients. Users are responsible for implementation of the generic Pub/Sub client interface provided by Zserio. However, Zserio provides sample implementations of several Pub/Sub backends:

Note that Zserio doesn’t provide any Pub/Sub server. There are various implementations of servers (e.g. mosquitto) and it’s the responsibility of the user’s Pub/Sub client implementation to communicate with the appropriate server.

Contributions

Contributions are very welcome but we encourage to open a discussion or an issue first to agree on a solution or to avoid useless work in case we are already solving a similar problem. Please see Contribution Guide.