JSON Flatten / Unflatten Free
Flatten deeply nested JSON objects to dot-notation keys like user.address.city, or unflatten dot-notation keys back into nested objects. Custom delimiter, array handling, and depth limit. Runs entirely in your browser.
Nested JSON Input
Flattened JSON Output
Pro — batch flatten, custom array delimiter, schema-aware flattening, API
API access · Priority queue · Team workspace
How It Works
Choose Mode & Paste JSON
Select Flatten to convert nested objects to dot-notation, or Unflatten to rebuild nested structure from flat keys. Paste your JSON in the left panel or click Sample JSON to load a deeply nested user profile with address, preferences, and notification settings — a realistic example showing multiple levels of nesting.
Configure Options
Choose the delimiter character for joining key paths (dot is universal, slash is common in YAML paths, underscore is used in some database schemas). Set a maximum depth to partially flatten — for example, depth 1 flattens only the first level of nesting, leaving deeper structures as objects. Toggle array flattening to expand array indices as keys.
Copy or Download
Click Flatten or Unflatten to see the result instantly in the right panel. The stats bar shows the original key count versus the flattened key count so you can verify the transformation. Copy to clipboard to paste into code, or download as a .json file for direct use in scripts and data pipelines.
JSON Flatten Features
Deep flatten and unflatten with full control over paths and delimiters
Unlimited Depth Flatten
Recursively flattens all levels of nested objects — {"a":{"b":{"c":1}}} becomes {"a.b.c":1}. Handles any depth without stack limits. Primitive values, strings, numbers, booleans, and null are preserved at their correct types. Objects and arrays at the leaf level are flattened or stringified depending on your array mode setting.
Unflatten Back to Nested
Reverses the flatten operation — takes a flat object with dot-notation keys and reconstructs the original nested structure. {"user.name":"Alice","user.age":30} becomes {"user":{"name":"Alice","age":30}}. Useful for restoring database rows or environment variable maps to their structured form.
Custom Delimiter
Choose dot (.), slash (/), underscore (_), or double underscore (__) as the path separator. Dot notation is the JavaScript standard and is understood by most tools. Slash notation is used in JSON Pointer (RFC 6901) and YAML paths. Underscore is popular in environment variable names like APP_DB_HOST for configuration management.
Array Index Flattening
Optionally expand arrays using their index as a key segment — {"tags":["a","b"]} becomes {"tags.0":"a","tags.1":"b"}. This is useful when you need every single value at a unique key path for database storage or CSV export. When disabled, arrays are kept intact as array values under their parent key.
Partial Flatten (Max Depth)
Set a maximum flatten depth to partially expand nested structures. Depth 1 flattens only the immediate children of the root object; deeper nested objects stay intact as objects. This is useful when you want to normalize the first level of an API response while preserving complex sub-objects like addresses or metadata as structured values.
100% Private
All flattening and unflattening runs in JavaScript in your browser — no data is sent to a server. The tool is safe for deeply nested API responses containing authentication tokens, personally identifiable information, financial data, or internal application configuration. Your data stays on your device at all times.
Free vs Pro
| Feature | Free | Pro |
|---|---|---|
| JSON input size | Unlimited | Unlimited |
| Flatten & Unflatten | ||
| Batch file flatten | — | |
| Schema-aware flattening | — | |
| Custom array delimiter | — | |
| REST API access | — |
Frequently Asked Questions
JSON flattening is the process of converting a deeply nested JSON object into a single-level object where all nested keys are joined into one key using a separator character (usually a dot). For example, {"user":{"address":{"city":"NYC"}}} becomes {"user.address.city":"NYC"}. This is useful for storing JSON in tabular formats, comparing configs, or passing structured data as environment variables.
When array flattening is disabled, arrays are kept as array values at their parent key — the nested objects inside the array are not expanded. For example, {"tags":["a","b"]} stays as {"tags":["a","b"]} in the output. When enabled, arrays are expanded to {"tags.0":"a","tags.1":"b"}. Choose based on whether you need each array item at a unique addressable key.
Yes — this is a common and recommended workflow. First wrap your JSON object in an array (if it isn't already), flatten it to expand all nested fields into dot-notation columns, then copy the output and paste it into the JSON to CSV tool. This produces a CSV where nested fields like user.address.city each appear as their own column, giving you a fully normalized, flat spreadsheet.
Yes — select the same delimiter that was used when the data was originally flattened. If you have keys like user/address/city, select slash as the delimiter and unflatten will correctly split on slash to rebuild the nested structure. If you mix delimiters in your input, the tool will only split on the selected one, leaving other separators as literal characters in key names.
Flattening transforms a nested JSON object into a single-level one — it is a structural transformation. JSON Diff compares two JSON objects and highlights what is added, removed, or changed between them — it is a comparison operation. You can use flattening to make two JSON objects easier to compare by eye (flattened keys are often easier to scan), but for programmatic comparison use the JSON Diff tool.
No — all processing runs entirely in your browser using JavaScript. No data is uploaded, transmitted, or stored on any server. You can open browser developer tools and monitor the Network tab to confirm there are zero requests made during conversion. This makes the tool completely safe for sensitive JSON payloads including authentication data, personal information, and internal application state.