Flatten a JSON Object
Flatten nested JSON into single-key paths such as user.address.city, with array indices included. Runs in your browser.
What flattening a JSON object does
Each leaf becomes one key whose path names every step from the root: objects contribute their key, arrays contribute the element index. An empty object or empty array is kept as a value rather than dropped, so a flattened document never loses the fact that a branch was empty. One caveat is real: an object whose keys are numeric strings flattens to the same path as an array, so unflattening always rebuilds the array form.
How to use it
Flatten a JSON Object: paste the JSON into the box above, set Delimiter (default ".") and Indent (default 2), and press Run to get the flat JSON below.
Worked example
Input:
{
"id": 42,
"displayName": "Ada Lovelace",
"active": true,
"score": 9.5,
"tags": [
"math",
"engine"
],
"address": {
"city": "London",
"country": "GB"
},
"projects": [
{
"name": "Analytical Engine",
"year": 1843
},
{
"name": "Note G",
"year": 1843,
"notes": "first published algorithm"
}
],
"nickname": null
}
Output:
{
"id": 42,
"displayName": "Ada Lovelace",
"active": true,
"score": 9.5,
"tags.0": "math",
"tags.1": "engine",
"address.city": "London",
"address.country": "GB",
"projects.0.name": "Analytical Engine",
"projects.0.year": 1843,
"projects.1.name": "Note G",
"projects.1.year": 1843,
"projects.1.notes": "first published algorithm",
"nickname": null
}
Why it runs in your browser
The conversion happens on this page with JavaScript. Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere. The page reads JSON and returns flat JSON; reloading the page discards both.
Each leaf becomes one key whose path names every step from the root: objects contribute their key, arrays contribute the element index. An empty object or empty array is kept as a value rather than dropped, so a flattened document never loses the fact that a branch was empty. One caveat is real: an object whose keys are numeric strings flattens to the same path as an array, so unflattening always rebuilds the array form.
Flatten nested JSON into single-key paths such as user.address.city, with array indices included. Runs in your browser.
How to use it
Flatten a JSON Object: paste the JSON into the box above, set Delimiter (default ".") and Indent (default 2), and press Run to get the flat JSON below.
Why it runs in your browser
The conversion happens on this page with JavaScript. Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere. The page reads JSON and returns flat JSON; reloading the page discards both.
What to Expect
Best for
- Converting JSON to flat JSON when the data is already on screen.
What this tool keeps
- Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere.
Sample input
{ "id": 42, "displayName": "Ada Lovelace", "active": true, "score": 9.5, "tags": [ "math", "engine" ], "address": { "city": "London", "country": "GB" }, "projects": [ { "name": "Analytical Engine", "year": 1843 }, { "name": "Note G", "year": 1843, "notes": "first published algorithm" } ], "nickname": null }
Sample output
{ "id": 42, "displayName": "Ada Lovelace", "active": true, "score": 9.5, "tags.0": "math", "tags.1": "engine", "address.city": "London", "address.country": "GB", "projects.0.name": "Analytical Engine", "projects.0.year": 1843, "projects.1.name": "Note G", "projects.1.year": 1843, "projects.1.notes": "first published algorithm", "nickname": null }
Frequently asked questions
How do I use the flatten a json object?
Flatten a JSON Object: paste the JSON into the box above, set Delimiter (default ".") and Indent (default 2), and press Run to get the flat JSON below.
Is my input uploaded?
No. The text is parsed on this page with JavaScript and is never posted to a server.
Is there a size limit?
Yes: 5 MB per run. Larger input is refused with a message rather than freezing the tab.
Build custom tools for your store
Join the SDK program to create useful ecommerce utilities for your store.