About JSON Flattener
Spreadsheets, environment variables, translation files, search indexes and many logging tools want flat key and value pairs, not nested objects. Paste nested JSON and every value comes out under the full path that leads to it, such as order.customer.name or order.items[1].qty.
Choose plain separator paths (a dot, a slash, an underscore or a double underscore) or bracket paths, which mark array indexes and quote keys containing dots so that every path reads back exactly. The same tool unflattens: switch the direction or press swap to rebuild the nested document from its paths.
How it works
- The document is read by a strict JSON parser that keeps numbers exactly as written and treats every key, even __proto__, as ordinary data.
- Every value that is not a non-empty object or array becomes one entry, keyed by the path to it. Empty objects and arrays are kept as values so nothing disappears.
- Unflattening splits each path into its parts and rebuilds the objects and arrays. A whole number in a path makes an array unless you turn that off; missing array items become null.
Questions
What if a key already contains a dot?
With separator paths, {"a.b": 1} and {"a": {"b": 1}} both flatten to "a.b", so the result cannot be unflattened faithfully. The tool warns when this happens. Bracket paths quote such keys, as in ["a.b"], and always read back exactly.
Why did unflattening make an array where I wanted an object?
A path part that is a whole number, such as the 0 in tags.0, is read as an array index. Turn off “Number segments make arrays” to keep it as an object key, or use bracket paths, where only [0] means an index.
What happens to two paths that clash?
If one path gives a place a value and another needs that place to be an object, as with "a": 1 and "a.b": 2, there is no single correct result, so the tool stops and names the path instead of guessing.
How large a document can it handle?
Up to 5 MB of JSON, nested up to 1,000 levels. It all runs in this browser tab, so the data never leaves your device.
Everything you enter here is processed in this browser tab. Nothing is uploaded, logged or shared. How privacy works here.