JSON BinPack

Binary JSON for the Internet of Things

An open-source binary JSON serialization format based on JSON Schema with a strong focus on space-efficiency. Transmitting smaller payloads reduces operational costs and improves user experience.

JSON, JSON Schema and JSON BinPack buffer example

Standing on the Shoulders of Giants

JSON BinPack was optimized for space-efficiency taking insights from almost 40 years of serialization technologies Timeline of Binary Serialization Formats

Highly Space-efficient

A reproducible benchmark study has proven JSON BinPack to be space-efficient in comparison to 12 alternative binary serialization formats in every considered case. Additionally, JSON BinPack typically provides higher average size reduction than general purpose compressors such as GZIP, LZMA and LZ4 with the highest compression levels.

Take a look at the benchmark
Example of benchmark plots

Based on JSON Schema

JSON BinPack adopts the industry-standard schema language for JSON documents. Re-use the same schemas you already have in your OpenAPI, AsyncAPI, RAML or other specifications. No need to learn more domain-specific schema languages or attempt to translate between them.

Learn more about JSON Schema
Logs of specifications using JSON Schema

Optional Schema

JSON BinPack is a hybrid serialization format that runs in both schema-driven and schema-less modes. Thanks to JSON Schema, JSON BinPack allows you to be as loose or specific as your use case demands, even within the same document, without having to use different serialization technologies.

Read more about JSON Schema as a constraint system
Illustration of JSON Schema as a hybrid serialization format

Frequently Asked Questions

How does JSON BinPack compare to compression formats like GZIP?

Our reproducible benchmark study shows that the semantic information provided by detailed schema definitions enables a serialization format such as JSON BinPack to often outperform general-purpose compressors configured with even their highest supported compression levels, specially for small and medium-sized JSON documents. For large JSON documents, you can experiment combining JSON BinPack with a compression format to potentially achieve greater space-efficiency.

JSON BinPack is space-efficient, but what about runtime-efficiency?

When transmitting data over the Internet, time is the bottleneck, making computation essentially free in comparison. JSON BinPack particularly excels at improving network performance when transmitting data through unreliable and low-bandwidth connections on mobile and IoT systems.

If your use-case demands runtime-efficiency or zero-copy serialization, such as in the case of intra-service or inter-process communication, we suggest you consider alternative serialization formats such as FlatBuffers and Cap'n Proto.

How does JSON BinPack handle unknown fields?

JSON BinPack serializes any instance that matches its JSON Schema definition. JSON Schema is an expressive constrain-based language that permits schema-writers to be as strict or loose on defining data as they wish. As a consequence of adopting JSON Schema, JSON BinPack elegantly supports encoding free-form data and unknown fields as long as the corresponding JSON Schema definition successfully validates the data.

However, deserializing data that does not match the given JSON Schema definition is undefined behavior and will likely result in an exception being thrown.

Do you have further questions or feedback? Don't hesitate in reaching out on GitHub Discussions!

Research

JSON BinPack is the result of extensive binary serialization research at the Department of Computer Science of University of Oxford. The project is led by Juan Cruz Viotti, a computer scientist with first-hand exposure to the problem of space-efficient network communication in the context of IoT and APIs, under the supervision of Mital Kinderkhedia.

2022 JSON BinPack: A space-efficient schema-driven and schema-less binary serialization specification based on JSON Schema Awarded the 2022 CAR Hoare Prize for the best performance on the project in the MSc in Software Engineering Awarded the 2022 CAR Hoare Prize for the best performance in the examination by coursework in the MSc in Software Engineering Dissertation

Arxiv

2022 Benchmarking JSON BinPack Paper
2022 JSON Stats Analyzer Paper
2022 A formal taxonomy to classify JSON documents based on their size, content, structure and redundancy criteria Project
2022 A benchmark of JSON-compatible binary serialization specifications Paper
2022 A survey of JSON-compatible binary serialization specifications Paper

Digital Presentations

2022 University of Oxford Academic Poster Poster
2022 A Day in the Life of a Software Engineer University of Bath (Slides) Video