JSON Nested Array Flattener

Take a deeply-nested JSON array like [1, [2, [3, [4]], 5], 6] and flatten to [1, 2, 3, 4, 5, 6]. Configurable max depth (default: infinite), optional deduplication. Browser-only.

How to use the JSON Nested Array Flattener

Paste a JSON array with any depth of nesting. Set the max depth — 0 flattens it completely, 1 collapses a single level, 2 collapses two, and so on. Optionally deduplicate repeated values and sort the result. The output is a single flat array ready to copy.

Flattening nested JSON arrays

Nested arrays show up whenever data is grouped, paginated, or returned in batches — a list of lists where you actually wanted one flat sequence of values. Pulling them apart by hand is tedious and error-prone once the nesting goes more than a level or two deep.

This walks a JSON array to any depth and collapses it into a single level, with optional controls to limit how many levels to flatten, drop duplicate values, and sort what is left. It works on nested arrays specifically; to flatten a nested object into dotted-path keys like user.address.city, the JSON flatten tool handles that case instead.

Common use cases

  • Merge batches — collapse paginated results returned as an array of pages into one list.
  • Flatten matrix data — turn rows of rows into a single value stream.
  • Limit the depth — collapse only the outer levels while keeping inner groups intact.
  • Deduplicate — flatten and remove repeated values in one pass.
  • Tidy a tag list — combine nested tag groups into a flat, sorted set.

Frequently asked questions

Does it flatten nested objects too?

No — it flattens nested arrays. For nested objects, the JSON flatten tool turns them into dotted keys.

What does max depth do?

It limits how many levels are collapsed. 0 flattens completely; 1 collapses a single level of nesting; higher values flatten that many levels.

Can it remove duplicates?

Yes — enable Deduplicate to drop repeated values, and Sort to order the result.

Does my data leave the browser?

No — flattening runs entirely in your browser; nothing is uploaded.
Embed this tool on your site

Free to embed, no attribution required (but appreciated). Paste this where you want the tool to appear: