JSON Flatten and Unflatten Tool
Move data between nested objects and flat, dotted-key structures without manual mapping. This tool is designed for developers and data engineers handling JSON payloads that need structural transformation. It processes your data locally in the browser and outputs a transformed JSON structure that you can immediately copy or download.
How the Transformation Works
The tool operates by shifting the hierarchy level of your JSON data. When you select flatten, nested object keys are collapsed into a single-level object using a dotted-path syntax (for example, a.b instead of a nested object { "a": { "b": 1 } }). When you select unflatten, those dotted paths are expanded back into their corresponding nested object structure.
During the transformation, array positions are converted into numeric path segments. Most JSON consumers treat these numeric segments as object keys rather than true arrays in the final output.
Input and Output Details
Before running the transformation, you must choose the correct mode: Flatten or Unflatten. The tool accepts either nested or flat JSON input and provides the corresponding transformed output.
A standard JSON parser cannot always perfectly reverse specific structural changes, particularly if complex depth limits are involved. Because some transformations are not fully reversible in the browser, you must keep your original, pre-transformation JSON file safe until you have validated the output in the consuming application.
The output is delivered as formatted text in a browser copy-paste area or as a local file download. It does not replace a full production pipeline, parser, or deployment validation tool.
Processing and Edge Case Handling
The tool automatically cleans up common formatting errors in your input before processing. It removes trailing commas and byte-order marks, strips out standard comments, and converts single-quoted strings to double-quoted strings. It also automatically quotes bare member names to ensure valid JSON syntax.
However, the parser cannot infer values that are not standard JSON, such as Python-specific boolean values like True, or missing closing braces. You must manually fix these specific syntax errors before pasting the data into the tool.
If your JSON contains large numeric identifiers (integers larger than 2^53), standard JavaScript parsers will automatically round them, which causes the tail digits to be lost. To prevent this data loss, you must format these long identifiers as strings in your source JSON before entering it into the tool.
Practical Use Cases
Use this tool for specific, isolated structural changes:
- Refactoring documentation to show deep object paths in a single column.
- Debugging API responses to quickly isolate deep, nested properties.
- Preparing data migrations where object keys need to be mapped to database column names.
Important: browser parsers cover common practical cases. Always review generated files before using them in production, especially for configuration, subtitles, images and security-sensitive data.