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:
cbor-sync provides an extensible CBOR encoder/decoder:
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:
Install a comprehensive implementation tailored to Perl's many
You'll like the performance data…
Install a fast, simple implementation that supports
current Perl versions and whose license works well
with both open- and closed-source projects:
Or, if you need pure Perl, try:
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):
Another, work-in-progress Swift implementation that is geared towards integration in iOS and macOS via Cocoapods:
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
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:
Based on an older Elixir implementation, an implementation with a modernized code base is now available:
An early implementation has been on hackage for a while:
The cbor package is a minimal and lightweight implementation of just the core CBOR data structures. It encodes and decodes to and from OCaml strings:
The orsetto package is a serialization framework that includes streaming encoders and decoders for both JSON and CBOR:
Idiomatic, lightweight and fast CBOR (de)serialization in Scala. Zero dependencies, type-class based, easy to integrate.
clj-cbor is an extensible, native Clojure implementation of
the CBOR format:
A compact D implementation with a Dub package:
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 rather comprehensive implementation that addresses arbitrary precision arithmetic is available in both a C# and a Java version.
Dahomey.Cbor is a high-performance CBOR serialization framework for .Net (C#):
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.
The old Qt implementation is now deprecated, as Qt from version 5.12 now has built-in support:
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.
CBOR-lite is a simple Modern C++ header-only implementation designed for encoding and decoding of CBOR-based application level-protocols.
cborg seems to be a popular name for a CBOR implementation, here for C++ with a fluent interface:
A simple low-level streamed callback-based CBOR push parser in C and C++:
A basic C++ implementation heavily based on C++17 variants:
Not exactly a coder/decoder per se, but more type based compile time encoder/decoder generator that uses CBOR as one of underlying protocols:
A "zero-memory-footprint" C decoder in use on some microcontroller/IoT deployments with no memory allocation:
Qcbor is a full implementation of CBOR in highly portable C. Commercial quality with measures for software security, small code size, a test suite and documentation.