Browser-based Convert tool

JSON Flatten and Unflatten

Paste JSON and choose flatten or unflatten to move between nested objects and dotted paths.

100% browser-based · No upload to server · Free to use
Browser processing · up to 5 MB per file
0 chars
0 chars

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.

Frequently asked questions

Can I reverse the flattened data back to its original state?

You can successfully unflatten standard nested objects as long as none of the keys already contain the path separator. If you restrict the tool's maximum depth, the deeper structural levels will remain nested rather than fully flattening to a single level.

How does the tool handle arrays and lists?

The tool converts array position indices into numeric path segments (e.g., [0] and [1] become key segments). The resulting output treats these as object keys rather than maintaining a standard JSON array structure.

Will the tool fix my JSON if it has extra comments or trailing commas?

Yes. The repair function automatically removes comments, trailing commas, and byte-order marks. It also normalizes string quotes and quotes unquoted member names. However, it cannot resolve missing structural elements, such as an unclosed brace.

Why do my large numeric IDs change when I process the JSON?

JavaScript operates using 64-bit floating-point numbers. Any integer larger than 2^53 will be altered and lose its trailing digits. To keep your exact numbers, you must save them as text strings in the original JSON file before running the tool.

Do you upload my data to a server to process it?

No. The tool runs entirely inside your web browser. The file is read locally on your machine, and no data leaves your device during the transformation process.