JSON Flattener

Create a tagged JSON Pointer document preserving array and object containers.

Processing stays in this browser. Inputs are not uploaded.

Use strict JSON up to 200,000 characters, 20,000 values and 64 nesting levels. Duplicate keys, unsafe integers, nonfinite numbers and nonzero values that underflow to zero are rejected. Decimal precision and numeric spelling may change. This uses a tagged JSON Pointer envelope, not a dotted-key map.

Flatten JSON without losing container types

This tool creates a version 1 tagged JSON Pointer document, not a dotted-key map. Every source value gets a node containing its pointer and type. Object and array containers get explicit nodes, even when empty. Scalars use type value and include their JSON value. Choose Flatten document after pasting JSON.

Example: an array and an escaped key

The example {"items":[1,{}],"a/b":null} produces five nodes: the root object at the empty pointer, the items array, number 1 at /items/0, an empty object at /items/1, and null at /a~1b. The slash in the property name becomes ~1; tildes become ~0.

Why the format includes containers

A plain map of leaf paths cannot always distinguish an empty object from an empty array or an object key named 0 from array index zero. Explicit container nodes preserve those distinctions. Nodes appear in parent-before-child order, and array children use consecutive indices. Property enumeration may reorder integer-looking object keys; object key order is not part of the semantic round trip.

The envelope has exactly version and nodes. Container nodes have pointer and type; scalar nodes also have value. Send the complete document to JSON Unflattener. External flattening libraries may use incompatible formats and should not be assumed to accept this envelope.

Round-trip limitations and size

Round trips preserve parsed JSON value structure, including empty containers and unusual property names. Original whitespace, escape spelling, negative zero and exact high-precision decimal spelling are not retained. At most 2,500 nodes are supported. A conservative 200,000-character construction budget includes paths, scalar text and per-node overhead; long ancestor keys can reach it early. The final tagged output must also fit 200,000 characters so it can be pasted into the matching unflattener.

Reader limits and output

Input supports 200,000 characters, 20,000 values and 64 nesting levels. Duplicate keys, unsafe integers, nonfinite numbers and nonzero values that underflow to zero are rejected. Other decimals use JavaScript floating-point precision. Formatting, escape spelling and negative zero may normalize; quote precision-sensitive data as strings. General output is capped at two million characters, with tighter tagged-format limits described above where applicable. Processing stays in the browser, and editing inputs or options clears stale results.