🧩JSON Flatten and Unflatten

Flatten nested JSON into dot keys

Flattening and rebuilding nested JSON

Turning nested JSON into single-level keys such as user.name or items.0.price makes it far easier to paste into a spreadsheet or to maintain as a translation or configuration file. Paste JSON here and it is flattened immediately, and the opposite direction is implemented as well, so you can rebuild the nested structure from dot keys. Output is printed as indented JSON and can be copied in one click.

You choose how array indexes are written. Dot style gives items.0.name, bracket style gives items[0].name. The choice matters when converting back: in dot style a segment made only of digits is restored as an array index, so an object key that was literally "0" becomes an array instead. Use bracket style when that distinction matters to you. Empty objects and empty arrays have nothing below them, so they are kept as values and counted in the result.

One limit is worth stating plainly. If a key name itself contains a dot or a bracket, the flattened key cannot separate that character from a path separator, and rebuilding will split at the wrong place. The tool detects those keys and reports how many there are. When the input is not valid JSON, the browser parser message is shown as it is, including the position of the problem.

Frequently asked questions

How are arrays written?

Dot style produces items.0.name and bracket style produces items[0].name. When rebuilding, dot style treats a purely numeric segment as an array index, while bracket style only treats the number inside brackets as one.

What if a key name contains a dot?

Flattening still works, but the dot cannot be told apart from a path separator, so rebuilding splits it in the wrong place. The result reports how many such keys were found.

Are empty objects and null values lost?

No. An empty object or array has nothing below it, so it is kept as the value itself, and null is preserved as a value too.