Back

#serialization

3 APIs with this tag

CBOR API

Encode and decode CBOR (RFC 8949, Concise Binary Object Representation) — the IETF-standard binary data format behind COSE, WebAuthn/FIDO2, the EU Digital COVID Certificate, and many IoT and constrained-device protocols. The encode endpoint turns a JSON value into compact, definite-length CBOR, choosing the smallest head for each integer, string, array and map; the decode endpoint parses CBOR back into a JSON value. It implements the spec across all major types — unsigned and negative integers of every width, byte and text strings (including indefinite-length chunked strings), arrays, maps, tags, the simple values false/true/null, and half-, single- and double-precision floats — and rejects trailing or truncated data rather than silently mangling it. Byte strings and any non-UTF-8 text come back losslessly as {"_bytes_hex":"…"}, tags as {"_tag":{"tag":N,"value":…}}, non-finite floats as {"_float":"NaN|Infinity|-Infinity"}, and other simple values as {"_simple":N}, so encode and decode round-trip exactly. Bytes are exchanged as both hex and base64 so they survive any transport. Everything is computed locally and deterministically, so it is instant and private. Ideal for debugging CBOR, COSE and WebAuthn payloads, bridging JSON and CBOR systems, IoT and smart-card pipelines, and teaching the format. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is CBOR specifically; for MessagePack use the MessagePack API, for BitTorrent's Bencode use the Bencode API, for JSON, YAML, TOML or XML use those format APIs, and for base64, hex, URL or HTML encoding use a general encoding API.

api.oanor.com/cbor-api

MessagePack API

Encode and decode MessagePack — the compact binary serialization format ("it's like JSON, but fast and small") used by Redis, Fluentd, many RPC systems and IoT protocols. The encode endpoint turns a JSON value into MessagePack bytes, automatically choosing the smallest representation for each integer, string, array and map; the decode endpoint parses MessagePack back into a JSON value. It implements the full spec — nil, booleans, every fixed and variable integer width, float32 and float64, str and bin, arrays and maps, and the ext family — and rejects trailing or truncated data rather than silently mangling it. Binary (bin) values and any non-UTF-8 string come back losslessly as a {"_bytes_hex":"…"} object, and ext values as {"_ext":{"type":N,"hex":"…"}}, so encode and decode round-trip exactly. Bytes are exchanged as both hex and base64 so they survive any transport. Everything is computed locally and deterministically, so it is instant and private. Ideal for debugging MessagePack payloads, bridging JSON and msgpack systems, RPC and cache tooling, IoT pipelines, and teaching the format. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is MessagePack specifically; for JSON, YAML, TOML or XML use those format APIs, for BitTorrent's Bencode use the Bencode API, and for base64, hex, URL or HTML encoding use a general encoding API.

api.oanor.com/msgpack-api

Bencode API

Encode and decode Bencode (BEP 3) — the serialization format BitTorrent uses for .torrent metainfo files and tracker responses. The encode endpoint turns a JSON value into Bencode: objects become dictionaries with their keys sorted in raw byte order exactly as the spec demands, arrays become lists, whole numbers become integers, and strings become length-prefixed byte strings. The decode endpoint parses Bencode back into a JSON value and enforces the spec strictly — no leading zeros in integers, no negative zero, dictionary keys must be sorted and unique, and no trailing data is tolerated — so malformed input is rejected rather than silently mangled. Binary byte strings that are not valid UTF-8 are represented losslessly as a {"_bytes_hex":"…"} object, so encode and decode round-trip exactly even for the binary "pieces" field of a real torrent. Decode accepts the data either as text or, for genuinely binary payloads, as hex; encode returns both the Bencode text (when printable) and its hex bytes. Everything is computed locally and deterministically, so it is instant and private. Ideal for building and parsing .torrent files, tracker tooling, BitTorrent clients and DHT messages, and teaching how the format works. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is BitTorrent's Bencode specifically; for base64, hex, URL or HTML encoding use a general encoding API, and for JSON, YAML, TOML or XML use those format APIs.

api.oanor.com/bencode-api