What does flattening JSON mean?
Flattening converts nested JSON, objects inside objects and arrays, into a single object where each key is the full path to a value, such as user.address.city. The data is the same, but every value sits at one level.
Flat JSON is easier to compare, search and load into tools that expect simple key-value pairs: spreadsheets and CSV exports, Elasticsearch fields, i18n translation files, feature-flag systems and environment variables. Unflattening turns the dotted keys back into nested structures, which helps when an API or config loader expects the nested form.
How to use the Flatten
1.Paste JSON
Any object or array, however deeply nested.
2.Choose flatten or unflatten
Set the key separator and how array positions are written.
3.Copy the result
Or download it as a .json file.
Example: a user record
A user with name and a nested address, a roles array with two values and an active flag:
- user.name
- "Asha"
- user.address.city
- "Pune"
- roles.0 / roles.1
- "admin" / "editor"
- active
- true
- Keys
- 6
Four levels of nesting become six flat keys, and unflattening them restores the original object.
Paths you can read
Flattening walks the whole structure and writes one key per value, joining each level's name with the separator. Array items get their index, as roles.0 or, with brackets on, roles[0]. Empty objects and arrays are kept as values so nothing disappears.
Unflattening reverses it: keys are split on the separator, bracketed indexes are read as positions, and a numeric segment creates an array instead of an object. Flattening then unflattening returns the original structure.
Frequently asked questions
Why flatten JSON?
Flat keys map directly to spreadsheet columns, environment variables, translation files and search indexes.
Can I use a different separator?
Yes. Use _ or / or anything else, as long as it doesn't appear inside your key names.
Are arrays supported?
Yes. Each item gets its index in the path, and unflattening rebuilds the array.
What happens to null values?
They're kept as null under their full path.
Related tools
JSON Formatter & Validator
Pretty-print, minify, sort and validate JSON with line-numbered errors.
JSON ↔ CSV Converter
Convert JSON arrays to CSV and CSV back to JSON.
JSON Escape & Unescape
Escape text for a JSON string, or unescape \n, \" and \u codes.
JSON to TypeScript Interface Generator
Generate TypeScript interfaces or types from a JSON sample.
JSON ↔ YAML Converter
Convert JSON to YAML and YAML to JSON.
CSV to Markdown Table Generator
Turn CSV or spreadsheet cells into Markdown, ASCII or HTML tables.
More Developer tools
JSON & data
CSV tools
Network & system
Web & API
Git & releases
Encoding & security
- Base64 encode & decode
- URL encode & decode
- JWT decoder
- Hash generator
- HTML entity encoder
- Text to binary
- Morse code translator
- Caesar cipher & ROT13
- Random string generator
- Secret key generator
- 2FA code generator (TOTP)
- Encrypt & decrypt text
- Encrypt & decrypt files
- SSH key generator
- Base32 encoder and decoder
- Unicode escape converter
- Nano ID generator
- JWT generator
Text & code
- Regex tester
- Text diff checker
- Cron expression explainer
- Lorem ipsum generator
- Markdown previewer
- Slug generator
- Strip HTML tags
- Unicode character inspector
- URL parser
- Markdown TOC generator
- cURL converter
- Whitespace visualizer
- Markdown link extractor
- Regex escape
- Regex match extractor
- Split text by regex
- HTML, CSS and JS playground
- Mock data generator
- Keyboard event tester
- ASCII table