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.