Flatten JSON
Turn nested JSON into reversible path records that preserve empty containers and unusual keys.
How it works & useful details
How it works
Turn a nested document into a reversible list of path records. Every object and array has its own kind marker, even when empty; primitive records also carry a value. This preserves numeric-looking keys, null and escaped paths. Feed the exported JSON into JSON unflatten. Up to 10,000 records and 1,000,000 output characters.
Limits & privacy
Up to 1,000,000 characters, 50,000 values and 64 levels. Live previews pause above 40,000 characters; run the tool to process the full supported input. Imported files must be UTF-8 and under 1 MB. Your data stays on this device.
Numbers use JavaScript decimal precision. Unsupported large integers are rejected; quote identifiers to keep all digits. Duplicate object names keep their last value. Transforms preserve data, not source whitespace or number spelling.
Paths use JSON Pointer: an empty path selects the root, ~0 escapes a tilde, and ~1 escapes a slash.
About this tool
Flatten JSON converts nested objects and arrays into a list of path records, which is easier to store in a table or compare row by row. Each record keeps the path to the value, including escaped separators in unusual keys.
The result is designed to be reversible: the Unflatten tool restores the structure. Empty containers and numeric-like keys are preserved explicitly so the round trip does not lose information.
How to use it
- Paste the JSON document.
- Run the flatten operation to produce path records.
- Review how nested values and empty containers are represented.
- Copy the records or send them to the Unflatten tool.
Worked example
Flattening
{"user":{"name":"Ada","tags":["x"]},"a.b":1,"empty":{}}produces one record per node:
"" object
/user object
/user/name value "Ada"
/user/tags array
/user/tags/0 value "x"
/a.b value 1
/empty objectThe key "a.b" stays intact because paths use JSON Pointer slashes, not dots. The empty object is kept as its own record. Dot-notation flatteners typically lose both details, which makes their output impossible to reverse exactly.
Why flatten JSON
Flat records are easier to search, filter, and compare than a deep tree. You can load them into a spreadsheet, grep for a path, or diff two flattened documents line by line. Translation files, feature flag configurations, and CMS exports are common candidates.
Because every container is recorded with its kind (object or array), JSON unflatten can rebuild the exact original structure, including empty objects, empty arrays, and keys that look like numbers. Keys containing / or ~ are escaped as ~1 and ~0, as the JSON Pointer standard requires.
Frequently asked questions
What path syntax is used?
Paths use JSON Pointer, where an empty path is the root, ~0 escapes a tilde, and ~1 escapes a slash.
What happens to empty objects and arrays?
They are preserved as explicit records, which is what makes the flattening reversible.
What is the limit?
Up to 1,000,000 characters, 50,000 values, and 64 levels of nesting.
Can I get dot-notation keys like user.name instead?
This tool uses JSON Pointer paths so the result is always reversible. Dot notation is ambiguous when keys themselves contain dots.
