Dev tools

JSON ↔ CBOR

Encode JSON to CBOR bytes (shown as hex) or decode CBOR bytes back to JSON. Covers uint/negint/text/array/map/float/bool/null; no byte strings, tags, or indefinite-length items. Runs on your device.

Runs on your device. The file is never uploaded.

JSON to CBOR packs a document into CBOR and prints the result as space-separated hex; decode mode goes the other way, reading raw bytes. Integers get the narrowest head that fits, and anything fractional is written as a 64-bit float. Map keys keep your document order, so the bytes are not canonical CBOR.

Input

Options

Questions

What do the two modes do?

Encode, the default, reads JSON text and writes CBOR bytes shown as space-separated hex. Decode reads the raw bytes of the file you dropped and writes JSON back, pretty-printed with 2 spaces. CBOR is a compact binary encoding for the same kind of data JSON holds.

How do I decode the hex it gave me?

Convert it back to bytes first. Decode mode reads a binary file, not hex text, so run the hex output through the From hexdump tool to get a .bin file and drop that in. From hexdump accepts a plain run of hex pairs as well as a full dump.

Which CBOR types are supported?

Unsigned and negative integers, text strings, arrays, maps, floats, booleans and null, which is everything JSON itself can express. Byte strings and tags are not implemented and a file using them stops with a message naming the major type. Indefinite-length items are refused too.

How are numbers encoded?

A whole number inside the safe integer range gets an integer head using the smallest width that fits, so small values take one byte. Anything else, including any fractional number, is written as a 64-bit float. Decoding accepts half, single and double precision floats and gives you plain JSON numbers back.

Is this canonical CBOR?

No. Map keys are written in the order they appear in your JSON rather than being sorted, so two documents with the same content but different key order produce different bytes. Lengths do use the smallest head that fits. If you need deterministic encoding for a signature, do not rely on this.

Is my payload uploaded?

No. Both directions run in a Web Worker in this tab, with no upload and no stored copy. Documents nested more than 300 levels deep are refused rather than risking a stack overflow, and that is the only limit the tool imposes; everything else is bounded by your own device memory.

Related Dev tools

n→nJSON ↔ MessagePackEncode JSON to MessagePack bytes (shown as hex) or decode MessagePack bytes back to JSON. Covers nil/bool/int/float64/str/array/map: no bin, ext, or timestamp extension types.Runs on each file you dropn→nJSON ↔ RisonConvert JSON to Rison (the compact URI-safe notation Kibana/Elasticsearch use for query params) and back. This tool's own encoder/decoder for the documented core grammar (no reference implementation in this codebase to check against). Exotic edge cases like embedded control characters or surrogate-pair characters are not guaranteed byte-identical to the reference grammar.Runs on each file you dropn→nPHP serialize / unserializeConvert JSON to PHP's serialize() format and back. Covers null/bool/int/float/string/array. PHP objects (O:) are not implemented since they need a class registry this tool doesn't have.Runs on each file you dropn→nPLIST viewerView an XML property list (.plist) as JSON. Binary plist (bplist00) is not supported. It needs a separate binary-format parser this tool does not implement.Runs on each file you dropn→nGeoJSON ↔ CSVConvert GeoJSON Point features to CSV rows and back. LineString/Polygon geometries export as a flattened coordinate list (one-way; CSV->GeoJSON always builds Points). CSV parsing is fully quote-aware (src/csv.ts), so a quoted field holding a comma or a newline no longer shifts the coordinate columns.Runs on each file you dropn→nKML/GPX to GeoJSONConvert a GPX (waypoints/tracks/routes) or KML (Placemarks: Point/LineString/Polygon) file to GeoJSON. A hand-rolled tag scan, not a general XML parser: no styles, nested Folder hierarchy, MultiGeometry, or extended data.Runs on each file you drop