Boneyard Tools

JSON Flatten and Unflatten

Flatten nested JSON into single-level dot-notation keys, or rebuild nested objects and arrays from flat keys. Use a custom delimiter if you like.

How to flatten JSON

  1. Paste your JSON into the box.
  2. Choose flatten to get dot-notation keys, or unflatten to rebuild the structure.
  3. Copy the formatted result.

Examples

Nested object and array to flat keys

{ "a": { "b": 1 }, "list": [10, 20] }
{ "a.b": 1, "list.0": 10, "list.1": 20 }

Frequently asked questions

How are arrays represented when flattening?

Array items use their numeric index as the key segment, so list[0] becomes list.0. Unflattening turns purely numeric segments back into arrays.

Can I change the delimiter?

Yes. The default joiner is a dot, but you can switch to another character such as a slash or an underscore for both flatten and unflatten.

Does flatten then unflatten return the original JSON?

Yes. The two operations are inverses for normal JSON, so a round trip reproduces the same objects, arrays and values.

What happens to empty objects or arrays?

An empty object or array has no leaf values, so it produces no keys when flattened. Add data if you need it represented.

Is my JSON uploaded anywhere?

No. Everything is processed in your browser, so your data stays on your device.

Related tools