JSON Flattener

Flatten nested JSON into a single-level object with dot or underscore keys.

  • 100% client-side · your data never leaves your browser
  • Instant, no rate limits
  • Free, no sign-up
Input JSON
Flattened JSON

Your result appears here

Paste JSON into the panel on the left — everything runs privately in your browser.

Overview

JSON Flattener — Flatten Nested JSON Online

Flatten deeply nested JSON into a single-level object with dot- or underscore-delimited keys. A flat structure is exactly what spreadsheets, CSV exporters, key-value stores, and analytics warehouses expect — so flattening is usually the first step when you move JSON out of an API and into a table. Paste your data, choose a delimiter, and copy the flattened result. Everything runs locally in your browser.

No uploadsNo sign-upOpen source
  1. How flattening works

    Each nested path is collapsed into one key. With dot notation, {"user":{"address":{"city":"Paris"}}} becomes {"user.address.city":"Paris"}. Underscore mode produces user_address_city instead, which is safer for column names in SQL and many BI tools that dislike dots in identifiers.

    Arrays are flattened by index: {"items":[{"sku":"A1"}]} becomes {"items.0.sku":"A1"}. Scalar values (strings, numbers, booleans, null) are preserved exactly — flattening only changes the shape of keys, never the underlying values.

  2. When to flatten JSON

    • Preparing nested API responses for CSV or Excel export
    • Loading JSON into flat columnar stores or analytics tables
    • Diffing two payloads field-by-field without nesting noise
    • Mapping configuration to environment variables or feature flags
    • Feeding structured data to tools that only accept key-value pairs
  3. Flatten vs unflatten

    Flattening and unflattening are inverse operations. Flatten to push JSON into a tabular system; unflatten to rebuild the original nested object from dotted keys. If you exported flattened JSON and need the hierarchy back, the JSON Unflatten tool reverses the transformation using the same delimiter convention.

FAQ

Frequently asked questions

How are arrays flattened?

Array indices become part of the key path, for example items.0.name and items.1.name. The numeric segment preserves order so you can reconstruct the array later.

Dot or underscore — which should I use?

Use dots for readability and round-tripping back to nested JSON. Use underscores when the keys become column names in SQL, BigQuery, or spreadsheets, where dots can be interpreted as path separators.

Can I rebuild the original nested JSON?

Yes. Run the flattened output through the JSON Unflatten tool with the same delimiter to restore the original structure.

Is my data uploaded anywhere?

No. Flattening runs entirely in your browser. Your JSON is never sent to a server, logged, or stored.

Continue with a related tool

All tools

Learn more in our guides

All guides