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. Text workflows ↗

Only the recipe name and tool order are saved in this browser. Your input and results are never saved.

01 / Example

Example

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

02 / 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

The sample input is {"user":{"name":"Hello","message":"Welcome"},"active":true}; its converted form is { "/user/name": "Hello", "/user/message": "Welcome", "/active": true }.

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. Use path keys when a configuration reviewer needs to see which nested property changed without opening every object level. A root array is outside this operation because it requires an object at the top level. Follow one nested branch in the result: each additional object member adds a slash-delimited token, while an array value stays attached to the path that led to it. For an empty root, the output has a single empty path with an empty object. This helps distinguish a genuinely empty document from a missing conversion result. Before editing a flat key, decide whether its slash denotes a level or belongs to a literal property name.

Check the result

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. Try a property containing a slash and another containing a tilde; their path tokens must use ~1 and ~0, while an array remains a leaf value. Read each resulting path as a sequence of object-property names, not as a file path. An array remains a value at a leaf instead of turning each index into another path. Preserve the flat map if it will be edited by hand; changing a slash or tilde in a key may change the hierarchy when rebuilt. Verify an empty object explicitly, because an empty root still needs a representation. After a bulk edit, run the inverse conversion and compare the reconstructed JSON structure with the parsed source, including nested names that contain punctuation.

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

Explore guides

Conversion guides

Explore guides