flat

Array

Flattens a nested array one level deep. Useful when an API returns arrays-of-arrays or when you pluck an array-valued field from each object.

Syntaxflat

Use cases

Use caseDescriptionURL
Flatten nested arraysMerge a list of sub-arrays into a single flat array.https://httpip.es/api/pipe/echo:[[1,2],[3,4],[5,6]]|flat
Flatten matrix rowsCollapse a 2D matrix into a 1D list for counting or summing.https://httpip.es/api/pipe/echo:[[10,20],[30,40],[50,60]]|flat|sum
Merge tag arraysCombine per-item tag lists into one pool, then deduplicate.https://httpip.es/api/pipe/echo:[{"tags":["js","ts"]},{"tags":["ts","go"]}]|pluck:tags|flat|distinct|sort
Flatten then countFlatten and count total elements across all nested arrays.https://httpip.es/api/pipe/echo:[[1,2,3],[4,5],[6]]|flat|count

All commands