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:
Spomky-Labs/cbor-php is a simple, fast and complete implementation of the specification:
it supports all major types and provides abstract classes to extend the library with, e.g., custom tags
The library is well tested and works from PHP7.3 and up, including PHP8
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:
The newest Go implementation is fast, safe, and full-featured with API like JSON + toarray/keyasint struct tags:
Another full-grown Go implementation:
A comprehensive, high-performance implementation as part of a larger set of data representation format en- and decoders:
An implementation using Serde, a framework for serializing and deserializing Rust data structures efficiently and generically, is available on crates.io. It is maintained, but it does not support CBOR Tags, and the upstream serde module has declined to add support:
The CBOR-CODEC implementation, available on crates.io, supports Tags and can deal with objects without size limits:
The CBOR-RUST implementation has very little documentation, and claims to be not ready for production:
The rust-cbor implementation works with Cargo and is on crates.io, but is considered unmaintained. It does support CBOR Tags:
is another parser targeted specifically at generating diagnostic
notation and annotated hex for debugging:
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:
A Swift implementation fully setup for Swift's Codable Protocols for iOS, macOS, tvOS, and watchOS via Cocoapods, Carthage, or Swift Package Manager:
PotentCodables bolsters the Swift Codable system with support for JSON, CBOR, and even ASN.1:
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 an actively maintained, high quality implementation that
supports most CBOR tags, including those for representing cyclic
(recursive) references, via
pip install cbor2
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:
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 an early implementation in Erlang:
Based on an older Elixir implementation, an implementation with a modernized code base is now available:
A recent Erlang implementation emphasizes features such as extensible tag support, documentation, a larger test suite, a configurable depth limit, etc.:
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:
Encoding and decoding library with a simple API inspired by the Crystal stdlib JSON package:
CBOR.jl is a Julia package for working with the CBOR
data format, providing straightforward encoding and decoding for
Julia types. Install via:
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#, F#, VB.net):
System.Formats.Cbor is the built-in solution for .Net (C#, F#, VB.net):
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 been around for a while:
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.