Flatten JSON Online.
Flatten nested JSON into path-based keys with dot, bracket, slash, or underscore delimiters. Handle array indexes, sort keys, minify output, and unflatten JSON back to nested objects on the same page.
No signup · No uploads · Flatten and unflatten
Flattened JSON output
Flatten JSON online - free and private
A flatten JSON tool converts nested JSON into a flat object where each key represents the full path to a value. That makes deeply nested data easier to export, compare, search, store in a table, or map into systems that expect one level of keys. Everything runs client-side, so your JSON is never uploaded.
How to flatten JSON in three steps
- Paste nested JSON into the input, or load the sample.
- Choose delimiter and array options - dot, bracket, slash, underscore, and indexed arrays.
- Flatten and export - copy or download the flat JSON object.
Delimiter choices for flat JSON keys
Different tools expect different path styles. Choose dot notation
(user.name), bracket notation (user[name]),
slash paths (user/name), or underscore keys
(user_name). This makes the JSON flattener
useful for APIs, spreadsheets, databases, logs, and config files.
Array indexes and unflatten mode
Enable array indexing to create keys like users.0.email.
Disable it when you want arrays to stay as JSON values. Need to reverse
the process? Switch to Unflatten JSON mode to rebuild
nested objects and arrays from flat keys, with auto-detection for common
delimiters.
What flattening actually produces
Nested JSON becomes a single level of path keys:
{
"user": {
"name": "Ada",
"address": { "city": "London", "zip": "E1 6AN" },
"tags": ["admin", "dev"]
}
} flattens to:
{
"user.name": "Ada",
"user.address.city": "London",
"user.address.zip": "E1 6AN",
"user.tags.0": "admin",
"user.tags.1": "dev"
}
Notice the array indexes — tags.0, tags.1. They are
what make the operation reversible: the
unflatten tool sees a numeric segment and
rebuilds a real array rather than an object with the keys
"0" and "1".
Choosing a delimiter
Dots (user.address.city) are the default and the
most readable — they match JavaScript property access and spreadsheet
conventions.
Underscores when the consumer rejects dots. Environment
variables cannot contain them, and neither can many database column names, so
USER_ADDRESS_CITY is often the only option.
Brackets (user[address][city]) for PHP and HTML
form libraries, which expect nested form fields in exactly this shape.
Slashes to line up with JSON Pointer (RFC 6901).
One rule matters more than the choice: pick a delimiter that does not
appear in your real key names. If a key is literally called
"user.name", dot-flattening becomes ambiguous and the round trip
breaks.
What flattening is for
Loading nested JSON into a spreadsheet or a SQL column, where only flat key/value pairs fit. Turning a config tree into environment variables. Feeding a form library that wants bracketed field names. Producing flat keys for a key/value store. And making two deeply nested documents easy to compare line by line.
Why use this JSON flatten tool?
It is private, fast, and gives you the choices many simple flatteners hide. After flattening, you can compare structures with JSON Diff, convert flat records with JSON to CSV, or inspect output with JSON Viewer. Learn more in our guide on how to flatten JSON.
FAQ
Flatten JSON, answered.
How do I flatten JSON online? +
Paste nested JSON into the JSON Flatten tool and press Flatten JSON. The tool converts nested objects into a flat JSON object where each key contains the full path, such as user.address.city.
Which flatten JSON delimiters are supported? +
You can choose dot notation, bracket notation, slash paths, or underscore keys. Examples include user.name, user[name], user/name, and user_name. This helps match the format expected by your API, database, spreadsheet, or config tool.
Can it flatten JSON arrays with indexes? +
Yes. With Index arrays enabled, arrays become keys such as roles.0 or users.1.email. Turn it off to keep arrays as JSON values instead of expanding every item into indexed paths.
Can I unflatten JSON on the same page? +
Yes. Switch to Unflatten JSON mode to rebuild nested objects and arrays from flat keys. You can choose a delimiter or use auto-detect for dot, bracket, slash, and underscore paths.
Does JSON flattening change values? +
No. Primitive values such as strings, numbers, booleans, and null stay as real JSON values. Objects and arrays are only changed into path-based keys when you choose to flatten them.
Is my JSON uploaded when flattening? +
No. Flatten JSON and unflatten JSON both run entirely in your browser. Your data is never uploaded, stored, logged, or seen by any server.
What does flattening JSON actually do? +
It turns nested structure into a single level of keys that encode the path. { "user": { "address": { "city": "London" } } } becomes { "user.address.city": "London" }. The data is identical — only the shape changes — so it can be loaded into anything that expects flat key/value pairs, such as a spreadsheet column, an environment file, or a form.
Which delimiter should I use? +
Dot notation (user.address.city) is the most common and the most readable. Use underscores if the consumer cannot handle dots in key names — environment variables and some databases reject them. Bracket notation (user[address][city]) matches how PHP and many HTML form libraries expect nested data. Slashes align with JSON Pointer. Pick whatever your target system parses.
How are arrays handled when flattening? +
Array items get their index in the path, so { "tags": ["a", "b"] } becomes { "tags.0": "a", "tags.1": "b" }. That keeps the flattening fully reversible — the indexes are what let the unflatten tool rebuild the array rather than guessing at an object.
Can I flatten and then get my nested JSON back? +
Yes, that is the point of preserving array indexes in the path. Use the JSON unflatten tool with the same delimiter and you get the original nested structure back exactly. The round trip is lossless as long as none of your original keys already contained the delimiter character.