JSON Flatten / Unflatten — Dot Notation Converter
Flatten nested JSON to a single-level 'path → value' map (dot / bracket notation), or unflatten a flat map back into nested JSON. Compatible with lodash and Spring conventions. 100% local.
Last updated:
CommentsPaste nested JSON to get a flat map of dot / bracket paths to values, or paste a flat map to reconstruct the nested structure. Round-trips losslessly with either bracket (a[0].b) or dot (a.0.b) array notation.
What is JSON Flatten?
A flat JSON representation collapses every nested object and array into a single-level map where each key is the full path (like `user.address.city` or `items[0].name`) and each value is the leaf. It's the natural format for exporting JSON to spreadsheets, storing settings in a key/value backend (Vault, Redis, Spring @ConfigurationProperties), diffing two JSON documents by field, and feeding search engines that don't support nested queries. This tool converts in both directions and supports the two industry-standard array notations: bracket (Postman / JSONPath) and dot (lodash / Spring).
How to flatten and unflatten JSON
- 1Choose direction — Flatten (nested → flat) or Unflatten (flat → nested).
- 2Choose an array style: bracket (a[0].b) for JSONPath / Postman compatibility, or dot (a.0.b) for lodash / Spring.
- 3Paste your JSON. The output pane instantly renders the converted form.
- 4Copy the result. Keys containing the delimiter character are auto-wrapped in backticks so round-tripping stays lossless.
Tips & Best Practices
- ▸For CSV export, flatten first — one column per path — so every row is a rectangular record.
- ▸When your target is Spring @Value / configuration properties, choose dot-array style and switch the delimiter to match the framework's expectation (usually '.').
- ▸Empty objects and arrays are encoded as {} and [] sentinel keys so structure survives the round trip — don't strip them if you plan to unflatten.
Frequently Asked Questions
What array formats are supported?
Two conventions: bracket (a[0].b — used by Postman, JSONPath) and dot (a.0.b — used by lodash's _.get / _.set and Spring configuration). You can round-trip in either — pick the one your consumer expects.
Is flatten → unflatten lossless?
Yes for typical JSON. Empty objects and arrays are preserved via {} / [] sentinels in the flat map so structure is retained. Keys that themselves contain the delimiter are wrapped in backticks (`) to disambiguate.
Why would I need a flat JSON representation?
Exporting to spreadsheets (each row = one field), building a config store keyed by dot-path, diffing two JSON documents at the field level, and feeding into search indexes that don't support nested queries.
What if a key contains a dot?
The tool wraps such keys in backticks (e.g. `my.key.with.dots`) in the flat output so unflatten can round-trip correctly. If your keys frequently contain dots, switch the delimiter to / or __ in the toolbar for cleaner paths.
Is my JSON uploaded anywhere?
No. All processing happens locally in your browser as client-side JavaScript.
Try Next
JSON Escape
Escape strings for use inside JSON, or unescape JSON string literals back to plain text. Handles quotes, newlines, tabs, and Unicode.
Related Tools
JSON Formatter
Format, beautify, and validate JSON online. Free, fast, and 100% local — your data never leaves your browser.
JSON Validator
Validate JSON online with instant error location and structure statistics (depth, keys, node types). 100% local — your JSON never leaves the browser.
JSON Schema Validator
Validate a JSON payload against a JSON Schema online. Supports Draft 2020-12, format validation (date-time, uuid, email, uri), and shows errors by JSON pointer path. 100% local — nothing is uploaded.
JSON Schema Generator
Generate a JSON Schema from a sample JSON — output as standard Draft 2020-12, OpenAI function calling schema, or Anthropic tool_use schema. Powers LLM structured output pipelines.
JSONPath Tester
Test JSONPath expressions against sample JSON online. Get instant, highlighted results for queries like $.store.book[*].author.
JSON Diff
Compare two JSON documents structurally and see added, removed, and changed values by path. Handles nested objects, arrays, and type changes.