/

JSON Unflattener

Processed Client Side

Restore flattened JSON back to its nested structure — dot paths and bracket indexes become real objects and arrays.

Flattened keys
Reading as Flat JSON
Flat JSONLength: 505Lines: 21Size: 505 BytesCursor: 1:1
Nested JSON
19 keys expanded
JSONLength: 507Lines: 35Size: 507 BytesCursor: 1:1
19 keys read · 3 levels deep · 2 arrays rebuilt

Bookmark this tool now — skip the search next time you need it.

About JSON Unflattener

This tool runs entirely in your browser. Whatever you paste is processed on your own device and is never uploaded, logged, or sent to any server.

The JSON Unflattener does the opposite job: it reads a flat list of paths and rebuilds the nested document they describe. Paste a JSON object whose keys are dot paths, or one key = value pair per line, or a two-column CSV, and customer.address.city becomes a city field inside an address object inside a customer object. Bracketed and bare numeric segments — items[0].sku or items.0.sku — become real array elements rather than objects with numeric keys, and a gap in the indexes is filled with null, since JSON has no way to write a hole. The input format is detected as you type, so a list copied out of a properties file, a spreadsheet column or a logging tool works without converting it first. Everything runs in your browser.

Key features

  • Three input shapes accepted and detected automatically: a JSON object of paths, key = value lines, or a two-column CSV
  • Both array notations understood — items[0].sku and items.0.sku rebuild the same array
  • Numeric segments become array indexes, or stay object keys, from a single toggle — which is what you want when your data really is keyed by number
  • Five separators supported, so paths joined by underscores, slashes, dashes or double colons expand as readily as dot paths
  • Value types recovered from text input: 42, true, null and inline JSON become real values, while everything else stays a string
  • Quoted values kept as text, so an order id of "0042" does not come back as the number 42
  • Gaps in array indexes filled with null and reported, because a JSON array cannot have holes
  • Clear warnings instead of silent damage when the input contradicts itself — a path that is both a value and a container, a key that appears twice, or array indexes mixed with named keys under one parent
  • Comment and blank lines skipped, and a key,value header row ignored, so a pasted CSV export needs no cleaning up
  • Prototype-safe: a __proto__ or constructor segment becomes an ordinary key and cannot reach the object prototype
  • Syntax highlighting in both panes, copy to clipboard, download as .json, and a choice of 2 spaces, 4 spaces, tabs or minified output

How to use it

  1. Paste the flattened data into the left pane — a JSON object of paths, key = value lines, or CSV. The badge tells you which one was detected.
  2. Set the separator to whatever joins your keys: dot, underscore, slash, dash or double colon.
  3. Leave "Numbers make arrays" on to turn items[0] into an array, or switch it off to keep numeric segments as object keys.
  4. Leave "Detect value types" on for text input so numbers and booleans come back typed, or switch it off to keep every value a string.
  5. Choose the indentation for the rebuilt JSON, then read the warnings under the toolbar — they name every path the input could not describe cleanly.
  6. Copy the nested JSON or download it as a .json file.

Tips & common mistakes

  • The separator has to match the one the paths were written with. If a document comes back looking like one long key with no nesting, the separator is wrong — try underscore or slash before assuming the input is broken.
  • Turn off "Numbers make arrays" when your keys really are numbers. A price table keyed by year, or a lookup keyed by status code, should stay an object: as an array it would become ten thousand null entries with your data at the end.
  • Quote a value in the text formats to keep it a string. 0042 and 1.10 both change when they are read as numbers — a leading zero disappears and a trailing zero is dropped — which matters for order ids, postcodes and version numbers.
  • Missing array positions become null. If items[0] and items[2] arrive without items[1], the result has a null in the middle, because that is the only way JSON can express the gap. The warning tells you how many were filled in.
  • Two paths that contradict each other are reported rather than merged quietly. If user is a value on one line and user.name is a value on another, the value loses and the nested keys are kept — flattened exports rarely contain both, so it usually means two files got mixed together.
  • A CSV pasted straight out of a spreadsheet works: the key,value header row is skipped, quoted cells are unwrapped, and lines starting with # or // are treated as comments.
  • Round-trip your work. Flatten a document with the JSON Flattener, expand it back here with the same separator, and the two should be identical — if they are not, the flattener warnings will say which key was ambiguous.
  • This is the fastest way back from a properties file, a translation catalogue or a logging export to the JSON an API actually wants. Paste the whole list, set the separator, and post the result.
  • The rebuilt document is ordinary JSON, so anything downstream works on it: send it to the JSON Formatter to re-indent, the JSON Validator to check it against expectations, or the JSON to CSV converter if you need a table of records rather than a table of keys.

Related tools

Browse all 24 JSON tools

Frequently asked questions

10

Paste the flat keys into the left pane — as a JSON object of paths, as key = value lines, or as a two-column CSV — and the nested JSON appears on the right as you type. Set the separator your paths use, then copy the result or download it as a .json file. Everything runs in your browser.

Three, and it detects which one you pasted. A JSON object whose keys are paths; one key = value or key: value pair per line, as you would find in a properties file; or a two-column CSV, whose key,value header row is skipped and whose quoted cells are unwrapped. Blank lines and lines starting with # or // are ignored.

A segment made only of digits — items[0] or items.0 — becomes an array index; anything else becomes an object key. Switch "Numbers make arrays" off when your data really is keyed by number, such as a table keyed by year or by status code, so it stays an object rather than becoming a mostly empty array.

Yes — the separator can be a dot, underscore, slash, dash or double colon. If the output comes back as one long flat key with no nesting at all, the separator is the first thing to check; it almost always means the paths were joined with something other than the current setting.

With "Detect value types" on, a value that is valid JSON comes back typed: 42 is a number, true is a boolean, null is null, and an inline [1,2] or {"a":1} is parsed. Anything else stays a string. Quote a value to force it to stay text, which is how 0042 keeps its leading zero. Switch the toggle off to keep every value a string.

The gaps are filled with null and you are told how many. A JSON array cannot have holes — there is no way to write "position 1 is absent" — so if items[0] and items[2] arrive without items[1], the result has a null in the middle. If that is wrong for your data, renumber the keys before pasting.

You get a warning rather than silent damage. If user is a value on one line and user.name is a value on another, the plain value loses and the nested keys are kept. The same happens when array indexes and named keys arrive under one parent — it becomes an object, and the warning names the path so you can look at it.

Yes, that is one of the main uses. Export the two columns as CSV, or paste them straight in as key,value lines, and the nested document is rebuilt from the paths. Translation catalogues, feature flags and config exports all tend to live in a spreadsheet in exactly this shape.

Yes. A __proto__ or constructor segment is written as an ordinary own property and cannot reach the JavaScript object prototype, so a hostile flat file cannot pollute the page it is pasted into. The rebuilt document keeps the key exactly as written.

No. Reading the flat keys and rebuilding the document are JavaScript running in your browser tab, with no request that sends the text anywhere. Paste a production config or an export full of customer records without having to redact it first.