{ } JSON & DATA · CONVERTER

JSON Flatten

Flatten deeply nested JSON into a single level of path keys like user.address.city or items[0].price. Pick the separator, array style and depth, then export as JSON, key=value pairs or CSV.

Dot or bracket paths · Custom separator · Max depth · JSON / key=value / CSV
Tip: flatten before exporting nested JSON to spreadsheets or env files.Need to go back? JSON Unflatten (coming soon)
Separator
Max depth
Nested JSONFlattened as you type
Flat keys: 0
Original depth: 0
Time: –
Order-preserving · 100% Client-Side
◆ ABOUT THIS TOOL

What Does Flattening JSON Mean?

Turning a tree of nested objects and arrays into one level of path → value pairs.

Nested JSON like {"user": {"address": {"city": "Pune"}}} becomes {"user.address.city": "Pune"}. Every leaf value keeps its full path as the key, and arrays use their index: tags.0 or tags[0].

Flat data is what spreadsheets, CSV exports, environment variables, translation files (i18n), Elasticsearch/MongoDB queries, form libraries and analytics tools expect. It also makes it easy to grep or diff deeply nested configs.

Choose a separator that suits the target: . for i18n and query paths, __ for environment variables (DB__HOST), / for JSON Pointer-like keys. Max depth stops flattening at a given level and keeps deeper parts as JSON.

The flattener preserves key order and exact numbers, and warns you when a key already contains the separator or when two paths collide — both would make the result impossible to unflatten unambiguously.

a.b.c

Output Formats

The same data, three ways.

{ }

JSON

{"user.name": "Ada", "tags.0": "x"} — a flat object, ready for i18n files, APIs or the JSON Unflatten tool.

=

key=value

user.name=Ada — one per line, like .properties or .env files. Line breaks inside values are written as \n.

,

CSV

Two columns, key,value, properly quoted — opens directly in Excel or Google Sheets.

[0]

Array style

items.0.price (lodash/dot-object style) or items[0].price (JavaScript/JSONPath style).

◐ THREE STEPS

How to Use the JSON Flatten

Get your result in under ten seconds.

1

Paste nested JSON

Paste JSON or drop a .json file — it is flattened as you type.

2

Choose the path style

Pick the separator, dot or bracket array indexes, a maximum depth and whether to keep empty objects and arrays.

3

Export

Switch between JSON, key=value and CSV output, then copy or download.

✓ FEATURES

Why Use the JSON Flatten on Developers Web Tools

Fast, accurate and private — built for developers.

🪜

Any depth

Flatten everything, or stop at a chosen depth and keep the rest as JSON.

🔣

Your separator

Dot, underscore, double underscore, slash, colon, dash — or your own.

📤

Three formats

Flat JSON, key=value lines for .env/.properties, or spreadsheet-ready CSV.

⚠

Collision warnings

Flags keys that contain the separator and paths that would overwrite each other.

🔢

Exact values

Key order and big numbers are preserved precisely.

🔒

Private

Runs in your browser; large files are processed in a background worker.

FAQ

Frequently Asked Questions

Each item gets its index in the path: {"tags": ["a", "b"]} becomes tags.0 and tags.1 (or tags[0], tags[1] in bracket style). Arrays of objects flatten the same way: items.0.price.

They have no leaf values, so they'd disappear. With Keep empty {} [] ticked (the default), they're kept as {} or [] values so nothing is lost.

If a key is "a.b" and the separator is ., the flat key a.b is ambiguous — it could mean {"a.b": …} or {"a": {"b": …}}. Choose a different separator to keep it reversible.

Choose the __ separator and key=value output: {"db": {"host": "x"}} becomes db__host=x. Many frameworks (ASP.NET, Pydantic, Spring) map __ to nesting.

Yes — use the JSON Unflatten tool (coming soon) with the same separator and array style.

No. Flattening runs in your browser.