JSON Flatten / Unflatten (Dot Notation)
Paste JSON and switch between two modes. Flatten collapses a nested object or array into one flat object whose keys are paths like `app.server.ports[0]` — handy for environment variables, MongoDB update paths, i18n message files, CSV columns, or diffing two configs. Unflatten does the reverse, expanding flat dot-notation keys back into a nested structure. Choose the delimiter (`.`, `/`, `_`, `-`) and whether arrays use bracket notation (`items[0]`) or dotted indices (`items.0`). Empty objects and arrays are preserved as leaves so a flatten → unflatten round-trip returns exactly what you put in. Everything runs locally — your JSON never leaves the browser.
Output · 9 keys
{
"app.name": "demo",
"app.version": "1.2.0",
"app.features[0]": "search",
"app.features[1]": "export",
"app.server.host": "localhost",
"app.server.ports[0]": 8080,
"app.server.ports[1]": 8081,
"flags.beta": true,
"flags.maxUsers": 100
}Flatten and unflatten are exact inverses unless an object key contains the delimiter — switch delimiters if your keys have dots.
How to use
- Pick Flatten or Unflatten.
- Paste your JSON into the input box.
- Set the delimiter and array notation to match your target format, then copy the result.
Frequently asked questions
- Is the conversion reversible?
- Yes, for normal data. Flattening then unflattening with the same delimiter and array notation returns an identical object — empty objects/arrays and null values are kept as leaves so nothing is lost. The one exception is below.
- What if an object key contains the delimiter?
- Then the round-trip is ambiguous: a key like `a.b` flattened with the `.` delimiter is indistinguishable from nested `a` → `b`, so unflatten will split it. If your keys contain dots, pick a different delimiter (e.g. `/`) that doesn't appear in them.
- How are array indices handled?
- In bracket mode arrays become `list[0]`, `list[1]`; in dot mode they become `list.0`, `list.1`. On unflatten, any bracket index or a bare numeric segment is rebuilt as an array element, so a flat key `users.0.name` produces an array of objects.
- Does it modify my data types?
- No. Numbers, booleans, null, and strings are preserved exactly as JSON values; only the key structure changes. Output indentation (0/2/4 spaces) only affects formatting, not content.
Related tools
JSON Sort Keys
Sort the keys of a JSON object alphabetically. Optionally recurse into nested objects so the whole document is canonicalized.
Unicode Escape Converter
Encode text to \uXXXX, U+XXXX or HTML entities — and decode any of those back to text. Handles emoji and astral characters.
CBOR Decoder (Diagnostic Notation)
Decode CBOR (RFC 8949) from hex or base64 into readable diagnostic notation — integers, byte and text strings, arrays, maps, tags, floats, simple values, and indefinite-length items — entirely in your browser.
JSON Formatter & Validator
Format, beautify, minify, and validate JSON right in your browser.
JWT Decoder
Decode a JSON Web Token to inspect its header, claims, and expiration.
JSON Diff
Compare two JSON documents structurally — see exactly which keys were added, removed, or changed.