JSON flattener

Turn a nested JSON document into a single flat object whose keys are paths such as address.city or orders[0].sku, or go the other way and rebuild the nested structure. Useful for config files, form fields, spreadsheets and environment-style keys.

Direction
Array positions
Indent

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Choose Flatten or Unflatten.
  2. Paste the JSON. For flattening, pick bracket or dot style for arrays.
  3. Copy the result.

Example

{"a":{"b":[{"c":1},{"c":2}]},"d":"x"}

flattens to

{"a.b[0].c":1,"a.b[1].c":2,"d":"x"}

and unflattening that gives the original back.

Tips

Bracket style is clearer when keys can be numbers. Dot style matches tools that use items.0.name paths. Only JSON values are supported, so dates and similar types must already be strings.

Frequently asked questions

How are keys written?

Object keys are joined with dots. Array positions are written as [0] in bracket style or as a plain number part (a.0) in dot style. A key that is empty or contains a dot or bracket is written as ["the.key"] so that it can be read back.

What happens to empty objects and arrays?

They are kept as values ({} and []) under their path, so unflattening restores them. Without this they would vanish from the flat result.

How does unflatten decide between objects and arrays?

A part in brackets, or a part made only of digits, creates an array position; anything else creates an object key. Missing positions below the highest one are filled with null. This means an object whose keys are digits comes back as an array.

What are conflicts?

A conflict is when one key says a path is a value and another says it has children, for example "a": 1 together with "a.b": 2. The tool reports the key instead of choosing one.

Do the keys keep their order?

Yes, as JSON objects are read, with the exception that JavaScript puts integer-like keys such as "1" before other keys.

More in Developer

All tools in this category: Developer ·Updated November 3, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.