MessagePack & CBOR Inspector
Encode JSON locally and inspect every byte with offsets and value types
About
A client-side binary format inspector with JSON input, format selection, hex dump, and recursive byte tree visualization.
Examples
MessagePack reference map
encodeMessagePack({ compact: true, schema: 0 })"82 a7 63 6f 6d 70 61 63 74 c3 a6 73 63 68 65 6d 61 00"A two-entry fixmap with fixstr keys, a true boolean, and a zero positive fixint — deterministic key order.
CBOR negative integer
decodeCbor(new Uint8Array([0x20])){ value: -1 }Major type 1 with additional information 0 decodes as -1 - 0 = -1.
About this tool
MessagePack / CBOR Inspector encodes and decodes both binary JSON formats: encodeMessagePack/decodeMessagePack cover positive/negative fixints, fixstr versus str8/16/32 at the 32-byte boundary, fixarray/fixmap, and nil/bool/uint/int/float64 scalars, while encodeCbor/decodeCbor cover major types 0 (unsigned), 1 (negative), 3 (text string), 4 (array), 5 (map), plus false/true/null and float64. inspectJson parses JSON text and returns bytes, hex, value, tree, and error in one call.
Every decode returns a byte-offset tree: ByteTreeNode entries carry offset, header byte, hex slice, type label, and children, so map keys, string payloads, and container boundaries can be traced byte by byte. Map keys sort deterministically (localeCompare) on encode, making reference vectors byte-stable.
Failures are explicit: truncated inputs throw "Truncated input", trailing bytes after a value throw, unsupported bytes or CBOR lengths throw, and inspectJson surfaces JSON parse errors in the error field instead of throwing.
How to use this tool
Pick a format
Call inspectJson(text, "msgpack" or "cbor") or the encode/decode pair directly for byte-level control.
Read the tree
Walk tree children for offset, header, hex, and type at each node to audit the encoding layout.
Check boundaries
Watch 31- versus 32-byte strings (fixstr vs str8) and fixint edges (-32/-33, 127) when sizing payloads.
Handle errors
Catch truncation and trailing-byte throws, or read inspectJson's error field for bad JSON input.
Use cases
Auditing binary payload sizes
Compare MessagePack versus CBOR byte counts for the same JSON before picking a wire format.
Debugging decoder failures
Use offset trees to find the exact byte where a truncated or foreign payload breaks.
Teaching binary JSON encodings
Show how fixstr, fixmap, and major-type headers map JSON values to bytes.
Common mistakes
Mistake:Assuming 32-byte strings stay fixstr.
Fix:Fixstr tops out at 31 bytes — 32-byte strings switch to the 0xd9 str8 prefix with a length byte.
Mistake:Expecting CBOR and MessagePack bytes to match.
Fix:The formats use different headers (e.g. nil is 0xc0 vs 0xf6) — only decoded values are comparable.
Frequently asked questions
What does this tool do?
It encodes and decodes MessagePack and CBOR with encodeMessagePack/decodeMessagePack, encodeCbor/decodeCbor, and one-shot inspectJson — every decode returns a byte-offset tree with header, hex, type, and children per node.
How do fixstr and negative fixint boundaries work?
Strings up to 31 bytes use fixstr (0xa0 | length); 32-byte strings switch to the 0xd9 str8 prefix. Integers -32 to -1 encode as single negative-fixint bytes (e.g. -1 is 0xff), while -33 falls back to int8.
Is my payload uploaded or stored?
No. Encoding, decoding, and tree building run entirely in your browser.
Why did decoding throw, or why did inspectJson report an error?
Truncated buffers throw "Truncated input" and trailing bytes throw as well — check the tree offsets for the break point. An inspectJson error field means the JSON text itself failed to parse.
Related guides
References & standards
Related tools
.env Secret Safety Linter
Validate .env syntax and spot likely leaked credentials or placeholder secrets.
.htaccess Generator
Build an Apache .htaccess — HTTPS redirects, rewrites, error pages, security headers, and basic auth
2D Fluid Dynamics & Particle Physics Sandbox
A physics playground with two engines sharing one canvas. The fluid mode runs a real Eulerian Navier-Stokes solver — semi-Lagrangian advection, explicit diffusion, Jacobi pressure projection and vorticity confinement — that you paint with dye and velocity using mouse or touch. The particle mode is a damped Verlet N-body engine with gravity wells, Coulomb attractors and repulsors, spring links, wall restitution and elastic circle collisions. Particle counts adapt to the device (100k target on WebGL2 desktop, 2k-5k on CPU fallback), and every configuration exports as runnable code: a Matter.js world, a PixiJS ticker setup, or a standalone vanilla Canvas engine.
AI Function Calling Schema Generator
Generate function calling JSON schemas from TypeScript interfaces
Algorithm Arena & Data Structure Visualizer
Interactive arena for algorithms and data structures: eight sorting algorithms racing on one seeded input, six pathfinding algorithms walking generated mazes, and BST, AVL, Red-Black, B-tree, heap and trie operations replayed step by step with rotations highlighted. Every run shows the Big-O table and the phase-highlighted reference implementation in four languages, and compared values can be played as pitch (sonification) through the shared audio engine. Everything runs client-side; inputs never leave the browser.
Ansible Playbook Generator
Build an Ansible playbook — hosts, vars, and tasks with modules — as YAML