JSON Flatten

Convert nested JSON objects and arrays into a flat key-value map with dot and bracket notation. Root-level arrays use bracket keys (e.g. [0].id) that unflatten can restore.

  • Runs entirely in your browser
  • No data stored or sent to a server
  • Free forever — no signup
  • Instant conversion

Input and Output

Use the interactive encoder and decoder on this page to process your text.

Learn more about flattening JSON

How to Flatten Nested JSON

JSON Flattening

When to Flatten JSON

Flatten nested objects for CSV export, spreadsheet imports, log indexing, flat key-value storage, and analytics pipelines that expect single-level records.

Real-World Examples

{"user":{"name":"Ada","id":1}}{"user.name":"Ada","user.id":1}

Array items become bracket notation: items[0].sku

Prepare nested API responses for CSV export or BigQuery ingestion

Common Mistakes

  • Flattening arrays of objects with hundreds of items — key explosion can produce unwieldy column counts
  • Assuming flattened keys round-trip without the Unflatten tool
  • Mixing dot notation in original keys with generated dots — review output before import

Developer Tips

  • Flatten before JSON to CSV conversion for nested API data
  • Document your key delimiter convention for downstream consumers
  • Use Unflatten to restore hierarchy when editing flat configs

Frequently asked questions

How are nested keys represented?

Object keys use dot notation (user.name) and array indices use brackets (items[0].id).

Are array values flattened?

Yes. Each array element gets an index in the key path. Primitive arrays produce keys like tags[0], tags[1].

Does flattening change values?

No. Only the structure changes — leaf values remain identical.