Flatten Nested JSON
Turn deeply nested JSON into a single level of path-style keys such as user.address.city or items[0].name. It happens in your browser, so your data stays private.
- Use it as often as you like
- Private by design
- Custom separator
- Dot or bracket lists
- Runs on your device. Files are never uploaded.
- Free and unlimited. No sign-up, no watermark.
JSON flatten in three steps
No account, no email, no waiting for an upload.
- STEP 01
Add your nested JSON
Paste an object, or a list of objects, or open a .json file.
- STEP 02
Choose the key style
Pick a separator (a dot by default), dot or bracket list positions, and whether lists are flattened too.
- STEP 03
Copy the flat JSON
Every value now sits at the top level under a path-like key.
What JSON flatten does, and what it doesn't
We'd rather tell you up front than surprise you after the download.
What you get
- Your own separatorUse a dot, underscore, slash or any short text between the parts of a key.
- Two list stylesWrite list positions as items.0.name or as items[0].name, whichever your other tool expects.
- Lists of recordsIf the input is a list of objects, each object is flattened on its own.
- Lists can stay wholeTurn off 'Flatten lists too' to keep arrays as values and flatten only the objects.
- No data lostEmpty objects and empty lists are kept as values, so nothing silently disappears.
Good to know
- Keys can collideIf a key already contains your separator, such as a.b at the top level next to a nested a, the paths can clash. Pick a separator that does not appear in your keys.
- Objects or lists of objectsA single number or string cannot be flattened. Provide an object or a list of objects.
- Numbers are read by the browserIntegers beyond 2^53 may be rounded when the document is parsed. Use the JSON formatter if you need exact big numbers.
Your data never leave your device
The tool runs inside your browser instead of on our servers, so there is nothing to upload, store or delete afterwards.
Typical online tool upload
Your file travels over the internet, sits on someone else's computer for a while, and you wait for the upload and the download.
Mediaextractr no upload
The tool loads into your browser once, then works on your file locally. Nothing is sent, so nothing can leak.
When people use JSON flatten
Prepare for a spreadsheet
Flat keys map neatly to columns. See also JSON to CSV.
Build environment variables
Convert a nested config into FLAT_KEY style entries by choosing an underscore separator.
Compare configs
Flat keys make it easy to scan and diff settings that live at different depths.
Translation files
Convert nested language bundles to flat keys, and back with JSON unflatten.
Mediaextractr vs typical upload tools
| MediaextractrPrivate | Typical upload tools | |
|---|---|---|
| Your file is uploaded | Never | Yes |
| Sign-up needed | No | Often, after a few files |
| Daily file limit | None | Often 1–2 free files |
| Watermark | Never | Sometimes |
| Wait for upload & download | No | Yes |
| Speed on very large files | Depends on your device | Depends on their servers |
What flattening produces
Take {"user": {"name": "Ada", "tags": ["a", "b"]}}. With the default settings it becomes {"user.name": "Ada", "user.tags.0": "a", "user.tags.1": "b"}. Each key is the full path to a value.
Choose bracket list positions and the same data becomes user.tags[0] and user.tags[1], a style familiar from JavaScript and many query tools.
Choosing a separator
The best separator is one that never appears in your own keys. The default dot works for most data, but keys with dots in them, like domain names, can confuse the reverse step.
- Use an underscore for environment-variable style names.
- Use a slash for path-like keys.
- Use JSON unflatten with the same settings to rebuild the nesting.
- Check results in the JSON tree viewer.
Flattening for configuration and search
Flat keys suit systems that store settings as simple name and value pairs, such as environment variables, key-value stores and translation catalogs. Choose an underscore as separator and uppercase the keys in your editor to get variable names. For search indexes, flat paths make it easy to ask whether a given field exists, without writing recursive code.
Questions, answered
What does it mean to flatten JSON?
It means replacing nested objects and lists with a single level of keys that show the full path to each value, like user.address.city.
Does flattening my JSON send it to a server?
No. Flattening is a small script that runs in this browser tab. Your document is not uploaded.
How do I get items[0].name instead of items.0.name?
Change 'List positions' to the bracket style.
Can I flatten only objects and keep arrays?
Yes. Turn off 'Flatten lists too'.
How do I reverse it?
Use JSON unflatten with the same separator and list style.
Can I use it on a tablet?
Yes. It works in current browsers on tablets and phones, with pasting as the easiest way to load data.