Code Beautify / MULTIVERTO

Flatten JSON object

Turn nested JSON object properties into JSON Pointer path keys.

Live converterYour input stays in this browser. No text is uploaded for conversion.
The file stays in your browser.
Chain tools

Apply each text tool to the previous result.

01 / Guide

How it works

Walk nested objects and keep arrays and scalar values as leaves.

Good to know

Turn nested JSON object properties into JSON Pointer path keys.

02 / Example

Example

Your input{"user":{"name":"Hello","message":"Welcome"},"active":true}
Result{ "/user/name": "Hello", "/user/message": "Welcome", "/active": true }

03 / Guide

Flatten JSON object — How it works

What the conversion does

Turn nested JSON object properties into JSON Pointer path keys. Walk nested objects and keep arrays and scalar values as leaves.

Worked example

Start with the input shown on this page: {"user":{"name":"Hello","message":"Welcome"},"active":true}. The tool produces: { "/user/name": "Hello", "/user/message": "Welcome", "/active": true }. Try the example first so you can compare the two representations. Then replace it with your own material. The result is plain text that you can copy into an editor, a test fixture or a request only after checking that its destination expects the same form.

Format rules and limits

Flattening uses RFC 6901 JSON Pointer tokens for object property names: a slash separates levels, a tilde in a name becomes ~0 and a slash in a name becomes ~1. This is a path representation, not a general JSON compression method. Arrays remain whole leaf values, which avoids confusing numeric object keys with array indexes; scalars and empty objects remain leaves too. The reverse operation accepts a flat JSON object whose keys are such paths, creates nested objects, and rejects conflicting paths. An empty root object is represented by an empty path holding an empty object. This deliberately restricted mapping makes a round trip predictable for supported objects. Compare output against the original before using it as a database update: a slash in an ordinary key must be escaped, and a path that points inside an existing scalar cannot be reconstructed.

Check the result

Keep the original beside the transformed text while you inspect it. Compare a small known case first, especially one containing punctuation, a non-ASCII character, a repeated value or an empty field relevant to your data. A readable output is not proof that the receiving program accepts the same schema or conventions. If you exchange data between applications, run the receiving parser and review a few records after import. Keep important source files under version control so changes are reversible. Processing takes place in your browser; this page does not send the pasted input to a conversion server. Browser memory and the clipboard still need ordinary care on shared devices.

The source and result have different roles even when they look similar. The method above defines the accepted subset rather than every extension of the named format. For a strict receiving system, try a small known case before changing many records. If validation fails, return to the original input and the first reported error; editing only the generated result can hide the cause.

For a reliable round trip, flatten an object and then unflatten the generated paths before using them in a patch or import. Compare the reconstructed JSON structure, including empty objects, arrays and property names containing slashes or tildes. Do not manually edit a path prefix into a scalar leaf: the reverse tool rejects paths that overlap or attempt to create children beneath a leaf.

How this conversion transforms the input
JSON — Input
Read and transform structure
JSON — Result