Development

Flatten and Restore JSON

Flatten nested JSON into JSON Pointer paths and restore arrays, objects and empty containers without losing their types.

01Input and settings

The calculation runs in your browser. You can use the tool without installing software.

02Result

Waiting for input
Waiting for input

Enter your values or load the example to see the result here.

About this tool: Flatten and Restore JSON

Flatten nested JSON into JSON Pointer paths and restore arrays, objects and empty containers without losing their types.

The flat format contains two maps: containers records each object or array, and values stores scalar leaves under escaped JSON Pointer paths. This preserves empty arrays, empty objects and numeric object keys. Paste that complete format into restore mode to recover the original JSON.

Worked example

Input
{"user":{"name":"Ada"},"tags":["web"],"empty":{}}
Mode
Flatten
{"containers":{"":"object","/user":"object","/tags":"array","/empty":"object"},"values":{"/user/name":"Ada","/tags/0":"web"}}

Questions and answers

What does this tool do?

Flatten nested JSON into JSON Pointer paths and restore arrays, objects and empty containers without losing their types. The flat format contains two maps: containers records each object or array, and values stores scalar leaves under escaped JSON Pointer paths. This preserves empty arrays, empty objects and numeric object keys. Paste that complete format into restore mode to recover the original JSON.

What affects precision and input format?

The flat format contains two maps: containers records each object or array, and values stores scalar leaves under escaped JSON Pointer paths.

Where are the calculations performed?

The calculation runs in your browser. You can use the tool without installing software.

Comments (0)

Share your thoughts — please be polite and stay on topic.

No comments yet. Leave a comment — share your opinion!

To leave a comment, please log in.

Log in to comment