JSON Flatten / Unflatten (Dot Notation)
Developer
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
Base64 to Hex Converter (and back)
Convert a Base64 string to hexadecimal bytes and hex back to Base64, with URL-safe support, in your browser.
Quoted-Printable Encoder & Decoder
Encode text to MIME Quoted-Printable (RFC 2045) or decode it back — handling =XX escapes, soft line breaks, and UTF-8 — entirely in your browser, with 76-character line wrapping on encode.
Hash Generator (SHA)
Generate SHA-1, SHA-256, SHA-384, and SHA-512 hashes from text.
URL Encoder / Decoder
Percent-encode text for URLs, or decode encoded URLs back to text.
Base64 Encoder / Decoder
Encode text to Base64 or decode Base64 back to text, instantly.
JSON Formatter & Validator
Format, beautify, minify, and validate JSON right in your browser.