JsonSnacksRuns in your browser

JSON Flatten & Unflatten

New

Turn nested JSON into flat keys like customer.name, and back again.

Nested JSON0 lines
Flat JSON
The result appears here.

What does the JSON Flatten & Unflatten do?

Flattening turns nested JSON into a single level of keys, so {"customer":{"city":"Pune"}} becomes {"customer.city":"Pune"}. Unflattening reverses it. Flat keys are easier to put in a table, a spreadsheet, environment variables or a key-value store.

How to use the JSON Flatten & Unflatten

  1. Choose Flatten or Unflatten.
  2. Paste your JSON. The result appears as you type.
  3. Pick the separator (dot, underscore or slash) and how arrays are written.
  4. Switch to the Table view to read keys and values side by side, then copy the result.

When it helps

  • Preparing nested data for a spreadsheet or a database
  • Creating flat configuration keys
  • Comparing deeply nested documents key by key

Frequently asked questions

How do I flatten nested JSON?

Paste it into the tool with Flatten selected. Each nested value gets a key made from its path, such as order.items[0].sku.

Can I choose the separator?

Yes. Use a dot, underscore or slash, and write arrays as items[0] or items.0.

How does unflatten decide between arrays and objects?

Keys written as [0] or a plain number segment become array positions. Everything else becomes an object key.

What happens to empty objects and arrays?

You can keep them as {} and [] values or leave them out. Keeping them lets unflatten rebuild the original exactly.

Keep going with your JSON

Runs entirely in your browser: your JSON is never uploaded. Last updated 23 October 2026.

Paste JSON to begin. Size, validity and depth appear here.