JSON Flatten & Unflatten
Flatten nested JSON into dot-notation keys or unflatten flat JSON back to nested structure. Supports custom delimiters and array indexing.
Related JSON Tools
What Is JSON Flatten / Unflatten?
JSON flattening converts a deeply nested JSON object into a single-level object where each key represents the full path to a value using dot notation (or a custom delimiter). Unflattening reverses the process — it takes a flat object with path-like keys and reconstructs the original nested structure. This is useful for configuration management, database storage, and data normalization.
How to Use
- Select the mode: Flatten (nested → flat) or Unflatten (flat → nested).
- Paste your JSON object into the left textarea.
- Optionally set a custom delimiter (default: dot).
- The result is generated automatically as you type.
- Click Copy to copy the output to your clipboard.
Features
- Bidirectional: flatten nested JSON or unflatten flat JSON back to nested.
- Supports arrays — array indices become numeric keys (e.g. roles.0, roles.1).
- Custom delimiter support: use dot, underscore, slash, or any character.
- Handles empty objects and empty arrays gracefully.
- Runs entirely in your browser — no data is sent to any server.
FAQ
What delimiter should I use?
The default dot (.) is the most common choice and is compatible with libraries like lodash _.get(). Use underscore (_) or double underscore (__) if your keys already contain dots.
How are arrays handled?
Array elements are flattened using their numeric index as the key segment. For example, roles: ["admin", "user"] becomes roles.0: "admin" and roles.1: "user".
Is my data safe?
Completely. All processing happens locally in your browser using JavaScript. No data is uploaded or stored anywhere.
When would I use JSON flattening?
Common use cases include storing JSON in flat key-value stores (Redis, DynamoDB), diffing nested configs, mapping JSON fields to form inputs, and working with CSS-in-JS or i18n flat key systems.