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.
Zserio supports the following code generators:
- C++ Generator together with runtime library using C++11, and developed with special attention to functional safety and performance
- Java Generator together with runtime library
- Python Generator together with runtime library
In addition to these, Zserio provides specialized text generators for documentation and export
The Zserio serialization framework allows you to serialize data in a compact and efficient way.
The key features include
- compactness (smaller than most other serializers)
- advanced schema definition options
- cross-platform
- multiple programming languages
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.
To be able to serialize data with Zserio, you have to follow these basic steps:
- Download the runtimes and the Zserio compiler from Github Releases
- Set up your development environment with the Zserio runtime
- Write the schema definition
- Compile the schema and generate code
- 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.
- Optional elements
- Constraints
- Default values
- Parameters
- Alignments
- Offsets
- Arrays with indexed offsets
- Packed arrays
- Templates
- Generic services
- Generic Pub/Sub
- SQLite extension
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.
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. Extensions which are located in the directory from which the Zserio jar executable has been run and
which are named with the prefix zserio_
are automatically loaded as well.
More information how to implement a new Zserio extension can be found in the Zserio extension sample.
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:
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:
- C++ Zserio Pub/Sub Mosquitto backend
- Java Zserio Pub/Sub Paho MQTT backend
- Python Zserio Pub/Sub Paho MQTT backend
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 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.