Flatten JSON Object
Convert nested JSON objects to flat key-value pairs with dot notation, underscore, or slash separators
Paste a nested JSON object, pick your separator (dot, underscore, or slash), and get a flat key-value structure back in one click. Useful when you need to dump API responses into spreadsheets, map deep configs to environment variables, or diff two payloads without chasing nested brackets. And everything runs in your browser. Nothing gets uploaded.
How It Works
The tool walks every property in your JSON object. When it finds another object or array, it keeps going deeper and builds up the key path as it goes. Once it hits an actual value — a string, number, boolean, or null — it writes that value with the full concatenated path as the key. The separator you picked (dot, underscore, slash) joins each segment.
Examples
User Profile with Address
API returns a user object and you need it flat for a CSV export.
{
"name": "Sara",
"address": {
"city": "Berlin",
"zip": "10115"
}
}
{
"name": "Sara",
"address.city": "Berlin",
"address.zip": "10115"
}
E-commerce Order with Line Items
An order payload with an items array that you need flattened for a reporting dashboard.
{
"order_id": 4021,
"items": [
{"sku": "T-100", "qty": 2},
{"sku": "M-205", "qty": 1}
]
}
{
"order_id": 4021,
"items.0.sku": "T-100",
"items.0.qty": 2,
"items.1.sku": "M-205",
"items.1.qty": 1
}
Config File with Deep Nesting
A settings object four levels deep — common in app configs — flattened with underscore separators for environment variables.
{
"db": {
"primary": {
"host": "10.0.0.1",
"port": 5432
}
}
}
{
"db_primary_host": "10.0.0.1",
"db_primary_port": 5432
}
Who Uses This
Flatten API responses before inserting rows into flat database tables or sending data to analytics pipelines.
Turn nested JSON exports into flat structures that import cleanly into Excel or Google Sheets.
Convert nested config files to flat key-value pairs for environment variables or .env files.
Compare flattened versions of two API responses side-by-side to spot differences quickly.
Common Mistakes
If your top-level structure is [{...}, {...}], wrap it in an object first — {"data": [...]}. Flattening works on objects, not bare arrays.
JavaScript lets you get away with trailing commas. JSON does not. Remove them before pasting or the parser will reject the input.
Dot notation is the default, but if your keys already contain dots (like "file.name"), switch to underscores or slashes so the flat keys don't become ambiguous.
Technical Details
- Processing: 100% client-side — nothing uploaded
- Browser Support: Chrome, Firefox, Safari, Edge
- Max Depth: No limit — recursion handles any nesting level
- Separators: Dot (.), underscore (_), slash (/)
- Array Notation: Index (items.0) or bracket (items[0])
Frequently Asked Questions
What does it mean to flatten a JSON object?
It means converting a multi-level nested object into a single-level object. Each key becomes the full path from the root. So {"user":{"name":"Jo"}} turns into {"user.name":"Jo"}. The values stay the same — only the structure changes.
Can I unflatten the result back to nested JSON?
Yes, but not with this particular tool. You'd need an unflatten tool that splits the dot-notation keys and rebuilds the hierarchy. The operation is reversible as long as the separator isn't also used inside the original key names.
Is my data safe when I paste it here?
Yes. The flattening runs entirely in your browser using JavaScript. Nothing is sent to any server. You can disconnect from the internet and it still works — that's how you know it is truly client-side.
Why would I flatten JSON instead of just parsing it normally?
Flat structures are easier to search, sort, and import. Spreadsheets need flat rows. Logging systems index flat keys faster. And comparing two objects field-by-field is simpler when every value sits at the top level.
Does flattening preserve arrays or just turn them into numbered keys?
Arrays become numbered keys. An array like ["a","b"] at path tags becomes {"tags.0":"a","tags.1":"b"}. You can choose between index notation and bracket notation (tags[0]) depending on what your target system expects.