JSON Flatten & Unflatten
Flatten and rebuild JSON with typed paths, exact number tokens and empty containers.
This tool runs entirely in your browser. Your data is never uploaded, never stored, and never leaves your device.
Flatten and rebuild JSON using typed RFC 6901 path entries, preserving exact number tokens and distinguishing arrays from numeric object keys.
How to use it
- 1Choose Flatten for nested JSON or Unflatten for a Toolvore typed path list.
- 2Paste or load a UTF-8 JSON document and run the conversion.
- 3Inspect, copy or download the complete JSON result; reverse the result to verify its structure.
Example
- Input
- {"x":[]}
- Output
- {"format":"toolvore-json-flat-v1","entries":[ {"path":"","type":"object"}, {"path":"/x","type":"array"} ]}
What happens to your data
JSON is parsed and transformed locally in browser memory. The tool does not upload its contents. Original formatting is not preserved, and downloaded files remain your responsibility.
Last updated October 2026
Flatten nested JSON into explicit path-and-type entries, or reconstruct JSON from that typed list. Large integers and number spellings are preserved without conversion through JavaScript Number. Arrays, empty containers and object keys that look like array indices remain distinguishable.
The output is Toolvore’s versioned JSON envelope, not a generic dotted-key object, CSV table or JSON Patch document. Its paths follow RFC 6901 JSON Pointer, while its format and type fields are a Toolvore convention designed for reversible structural inspection.
How it works
Choose Flatten, paste one JSON document or load a UTF-8 file, and run the transformation. Every node receives an entry with path and type. Primitive values also have a value field containing the original JSON token. Objects and arrays have no value field; their children describe their contents, and an empty container still has its own entry. The root always uses an empty path.
A slash within a property name becomes ~1 and a tilde becomes ~0. Thus a literal key a/b has path /a~1b, while nested keys a then b have path /a/b. A numeric object key 0 remains an object member when its parent is typed object; /0 under a typed array is its zero-based first element. A literal dot has no special meaning.
The envelope has format equal to toolvore-json-flat-v1 and an entries array. To reconstruct, choose Unflatten and supply that envelope, or use the result directly in the reverse direction. A complete root and all container parents are required. Entries can arrive out of parent order. Object children are rendered in entry order; array children are ordered numerically and must form a dense sequence starting at 0. Sparse arrays are rejected rather than filled with invented nulls.
Duplicate object keys are rejected when flattening, including differently escaped keys that decode to the same name. Unflattening rejects duplicate paths, unknown or repeated envelope fields, missing parents, primitive parents, values whose type disagrees with their entry, container value fields and invalid pointer escapes. Special names such as __proto__ and constructor are treated as ordinary JSON keys, not assigned onto JavaScript prototypes. Untrusted content is never evaluated as code.
Number tokens such as 9007199254740993, -0 and 1.2300e+4 retain their spelling. Primitive string escape spellings are preserved too. Original whitespace and object-key escape spelling are not preserved: reconstructed JSON is compact, and decoded keys are serialized safely. This is structural and token-preserving conversion, not a byte-identical backup of the original source file.
Nested source JSON and reconstructed JSON are limited to 2 MiB. Typed path-list input and output may reach 8 MiB because explicit paths add overhead. Limits also include 10,000 total nodes, including containers, 64 path levels, 4,096 characters per path and 2 Mi combined path characters. Parsing has separate bounded token limits. Very long repeated paths can reach the path budget before the source-size limit. This is not a streaming converter for unbounded files.
All processing runs in browser memory. Input or direction changes invalidate previous output. A late file read cannot overwrite a newer edit. The preview is capped at 100,000 characters, while copy and JSON download contain the complete successful result. No file contents are uploaded by this tool.
Worked example: Keep an empty array distinct from a numeric-key object
- Input
- {"0":9007199254740993,"items":[]}
- Result
- {"format":"toolvore-json-flat-v1","entries":[ {"path":"","type":"object"}, {"path":"/0","type":"number","value":9007199254740993}, {"path":"/items","type":"array"} ]}
Unflattening returns the original compact structure, including the exact large integer and the empty array. /0 is an object member because the root is explicitly typed object.
Common use cases
- Inspecting nested configuration values by unambiguous paths
- Round-tripping JSON with large numeric identifiers
- Reviewing empty containers and array/object type differences
- Preparing an explicit path list for a controlled internal transformation
Frequently asked questions
Can I unflatten an object with dotted keys?+
No. Dotted-key conventions are ambiguous when actual keys contain dots, numeric keys could be objects or arrays, or containers are empty. This tool accepts its documented typed envelope and RFC 6901 paths only.
Does flattening turn JSON into CSV?+
No. It creates a JSON list of structural entries. Use JSON to CSV for a rectangular table or JSON Pointer when you only need to extract one value rather than list the entire structure.
Will a long integer or scientific-notation value change?+
No numeric coercion is used. Original number tokens are copied into the flat value and back into reconstructed JSON. A downstream application may still round them if it parses them into limited-precision numbers.
Why is a duplicate key rejected?+
Two values with the same decoded object key would need the same pointer path. Rejecting that ambiguity is safer than silently choosing the first or last value. Use JSON Formatter to inspect duplicate-key source documents.
Can I reorder the entries before rebuilding?+
Yes, as long as every required parent exists and paths remain unique and valid. Object-key order follows child entry order. Arrays are reconstructed by numeric index, with no gaps allowed.
Is the output a universal flattening standard?+
No. RFC 6901 standardizes the path syntax, not this envelope. toolvore-json-flat-v1 is the explicitly identified Toolvore format; other flattening tools may use incompatible dotted or separator-based conventions.
Related tools
JSON Pointer Extractor
Extract JSON values with RFC 6901 pointers, preserve exact digits and download locally.
JSON Formatter & Validator
Format, validate, and minify JSON with exact line errors, a searchable tree, and private processing.
JSON Diff
Compare JSON by ID, ignore noisy paths and export a strict JSON Patch when the comparison permits.
JSON to Excel Converter
Convert JSON to XLSX locally. Preserve long IDs, preview columns and handle nested data.