Restructure (Free Online Tool)
Flexibly restructure collections by grouping, unwinding, transposing, or rearranging nested data
Paste your JSON → Get results instantly (no signup)
→ Group these items by their type.
1{2 "fruit": [3 {4 "name": "Apple"5 },6 {7 "name": "Banana"8 }9 ],10 "vegetable": [11 {12 "name": "Carrot"13 }14 ]15}Love the result?
Use this exact pipeline in your app, backend, or LLM workflow.
No setup needed. Works with curl, Node, Python.
Uses example data. For edited input, copy from the playground.
Works with:
- API responses
- Nested JSON
- Arrays & objects
Example: input → output
[ { "type": "fruit", "name": "Apple" }, { "type": "vegetable", "name": "Carrot" }, { "type": "fruit", "name": "Banana" }]{ "fruit": [ { "name": "Apple" }, { "name": "Banana" } ], "vegetable": [ { "name": "Carrot" } ]}Related tools
- Rename KeysRename known keys or convert key casing without changing the underlying values
- Find & ReplaceFind and replace matching keys or values across JSON using broad search patterns
- FilterFilter rows, items, keys, or values by explicit conditions and keep only the matches you want
- Flatten / NestConvert nested objects to flat key paths or rebuild them using delimiter and casing rules
- Pick FieldsKeep only a known allowlist of fields and remove everything else
Advanced usage (optional)
Restructure
v1.0.0Description
Restructure
Reshape JSON structure — group items by a key, sort items or keys, unwind array fields into separate records, or transpose rows and columns.
Modes
Group By
Group array items by a specified field value. Creates an object where each key is a unique value of the group-by field, and the value is an array of matching items (with the group-by field removed).
[{ "type": "fruit", "name": "Apple" }, { "type": "fruit", "name": "Banana" }]
→ { "fruit": [{ "name": "Apple" }, { "name": "Banana" }] }Sort
Sort array items by a field value, or sort object keys alphabetically. Supports ascending and descending order.
Unwind
Expand array fields into separate records. Each item in the array field becomes its own record with all other fields duplicated.
[{ "name": "Alice", "tags": ["admin", "editor"] }]
→ [{ "name": "Alice", "tags": "admin" }, { "name": "Alice", "tags": "editor" }]Transpose
Swap rows and columns. Convert an array of objects into a column-oriented structure, or vice versa.
Configuration
| Field | Type | Default | Description |
|---|---|---|---|
| Mode | enum | sort | group-by, sort, unwind, or transpose |
| Group By Key | string | "" | Field name to group by (group-by mode) |
| Sort By Key | string | "" | Field name to sort by (empty = sort primitives or object keys) |
| Sort Order | enum | asc | asc or desc |
| Unwind Field | string | "" | Field containing arrays to unwind (unwind mode) |
| Target Paths | path-picker | [] | Scope operation to specific paths (empty = apply to root) |
Use Cases
Data Organization
- Categorize: Group products by category, users by role, events by type
- Sort records: Sort by date, name, score, or any other field
- Alphabetize keys: Sort object keys for consistent ordering
Data Transformation
- Denormalize: Unwind tag arrays to create one record per tag for analysis
- Pivot tables: Transpose row-oriented data to column-oriented format
- Aggregation prep: Group records before applying aggregate operations
Reporting
- Category reports: Group sales by region, expenses by department
- Ranked lists: Sort results by score, revenue, or date
- Flat exports: Unwind nested arrays for CSV export
Configuration
| Name | Type | Default | Description |
|---|---|---|---|
| Mode | enum | sort | group-by: group array items by a field. sort: sort items or keys. unwind: expand array fields. transpose: swap rows and columns. group-by sort unwind transpose |
| Group By Key | string | | Field name to group by (used in group-by mode) |
| Sort By Key | string | | Field name to sort by for arrays of objects (empty = sort primitives or object keys) |
| Sort Order | enum | asc | Sort direction (used in sort mode) asc desc |
| Unwind Field | string | | Field name containing arrays to unwind (used in unwind mode) |
| Target Paths | path-picker | [] | Scope operation to specific paths only (empty = apply to root) |
Examples
Group these items by their type.1{2 "fruit": [3 {4 "name": "Apple"5 },6 {7 "name": "Banana"8 }9 ],10 "vegetable": [11 {12 "name": "Carrot"13 }14 ]15}API Usage
curl -X POST https://your-domain.com/api/v1/utilities/structure.restructure \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"inputs":{"primary":[{"type":"fruit","name":"Apple"},{"type":"vegetable","name":"Carrot"},{"type":"fruit","name":"Banana"}]},"config":{"mode":"group-by","groupByKey":"type","sortByKey":"","sortOrder":"asc","unwindField":"","targetPaths":[]}}'1{2 "fruit": [3 {4 "name": "Apple"5 },6 {7 "name": "Banana"8 }9 ],10 "vegetable": [11 {12 "name": "Carrot"13 }14 ]15}