JSON Flatten and Unflatten Tool
Convert nested JSON to flat path-keyed JSON and back. Path syntax is a.b[0].c with strict distinction between array indexes and object keys, ideal for log analysis and field comparison.
About This Tool
The JSON flatten tool collapses nested JSON into a single layer of path-to-value pairs using a.b[0].c notation, which expresses both object nesting and array indexes. Many logging systems, analytics platforms and spreadsheet tools only accept flat key-value structures, so converting here saves writing a throwaway script.
Restoring the original structure matters just as much. When unflattening, numeric tokens become array indexes and string tokens become object keys, so arrays are never turned into objects with numeric keys. Keys containing dots or brackets are wrapped as ["key"] to keep the round trip reversible.
Key Features
Clear path syntax
Dots for objects and brackets for indexes, such as user.tags[0].name.
Fully reversible
Flatten and unflatten share one parser, so round trips keep the structure intact.
Special keys supported
Keys with dots or brackets switch to ["key"] form to avoid ambiguity.
Empty containers kept
Empty objects and arrays stay as leaf values instead of disappearing.
When to Use It
Log and analytics import
Flatten nested event payloads for spreadsheet or analytics import.
Field-level diffing
Flattened output makes path-level alignment and gap checking straightforward.
Configuration flattening
Expand multi-level config into single-layer environment-style keys.
How to Use It
- 1Choose Flatten or Unflatten.
- 2Paste the matching JSON content.
- 3Click Convert to generate the result.
- 4To verify, click Move Result to Input and run the opposite direction.
Frequently Asked Questions
Will arrays be restored as objects?
No. Numeric tokens in the path create arrays, keeping them distinct from object keys.
What if a key contains a dot?
The tool wraps it as ["key"], and unflattening still treats it as a single complete key.
