CBOR is simple enough to implement from scratch for a specific application.
For applications where that is not desirable, generic implementations are available for a variety of platforms. Many of these implementations stay private, but some are published with liberal open-source licenses such as the Apache 2.0 or the MIT license.
Many implementations use a simple API of the form:
encoded = CBOR.encode(data)
data = CBOR.decode(encoded)
A CBOR object can be installed via
bower install cbor and used as an AMD module or global object in the browser e.g. in combination with Websockets…
… and the server side for that might be written using node.js;
npm install cbor
Also, an implementation based on the higher speed C library tinyCBOR is now available:
A CBOR encoder/decoder suite with a test suite that incorporates the encode/decode tests from RFC7049 and more is now available in the Darts package ecosystem:
An early Go implementation that feels like the JSON library:
Another, more full-grown Go implementation:
Most recently, a comprehensive, high-performance implementation has become available as part of a larger set of data representation format en- and decoders:
A Rust implementation is available that works with Cargo and is on crates.io:
Another Rust implementation has also become available recently on crates.io:
A Swift implementation without a Foundation dependency (cross-platform ready):
CBOR.jl is a Julia package for working with the CBOR
data format, providing straightforward encoding and decoding for
Julia types. Install via:
Lua-cbor is a pure Lua implementation of CBOR for Lua 5.1—5.3, which utilizes struct packing and bitwise operations if available:
“The most comprehensive CBOR module in the Lua universe” supports everything mentioned in RFC 7049 and the extensions registered with the IANA so far. It comes with parts implemented in C.
lua-ConciseSerialization is a pure Lua implementation of CBOR with variants for both 5.1 and 5.3;
luarocks install lua-conciseserialization.
Install a high-speed implementation via pypi:
pip install cbor (and/or possibly
pip3 install cbor)
Flynn's' simple API is inspired by existing Python serialisation modules like json and pickle:
Flunn is a fork of flynn, fixing some compatibility issues and with some refactoring:
Install a high quality implementation that supports most CBOR
tags, including those for representing cyclic (recursive)
pip install cbor2
Install a comprehensive implementation tailored to Perl's many
You'll like the performance data…
A high-speed implementation has been derived from the
implementation for Ruby. Installation:
gem install cbor
Ruby bindings for libcbor are now available. Installation:
gem install libcbor
cbor-erlang is a recent implementation in Erlang:
An older Elixir implementation is also available:
expm spec excbor --format scm | sh
Or look at the source:
An early implementation has been on hackage for a while:
clj-cbor is an extensible, native Clojure implementation of
the CBOR format:
A rather comprehensive implementation that addresses arbitrary precision arithmetic is available in both a C# and a Java version.
A Java implementation as part of the popular Jackson JSON library is at:
A Java 7 implementation focusing on test coverage and a clean separation of model, encoder and decoder is at:
JACOB, a small CBOR encoder and decoder implemented in plain Java is at:
borabora supports graph queries and lazy decoding of stream elements:
Cyborg supports a stream parsing/generation API without the need to adapt your data to a specific model:
A CBOR implementation in C is part of the RIOT operating system for constrained nodes:
A C implementation for highly constrained nodes, which achieves a full CBOR decoder in 880 bytes of ARM code (and now also includes an encoder), has recently become available.
A basic C++ implementation is also available:
libcbor provides a fully-fledged C99 implementation, including streaming and incremental processing functionality:
TinyCBOR is Intel's industrial strength C/C++ implementation of CBOR, as used in the IoTivity framework:
JSON for Modern C++ — a header-only C++ library that aims to promote JSON to a first-class data type in C++11 — now supports CBOR as (de)serialization format.
A Qt İmplementation is at:
GoldFish is a fast, header-only C++11 library for CBOR and JSON that minimizes memory allocation by providing a SAX-like, but pull-oriented interface. Currently only ported to Visual C++.
jsoncons is a C++11, header-only library for JSON construction that supports encode to/decode from CBOR.
A compact D implementation with a Dub package: