Shape (Free Online Tool)
Enforce a known target shape by extracting paths, ensuring arrays, unwrapping values, or plucking indices
Paste your JSON → Get results instantly (no signup)
⚡ Instant resultsNo signupRuns in your browser
Try examples:
→ Unwrap this singleton array into its single value.
Output✓
Output✓
1{2 "username": "Morgan",3 "email": "m@test.com"4}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
Input / OutputInputOutput
Input
[ { "username": "Morgan", "email": "m@test.com" }]Output
{ "username": "Morgan", "email": "m@test.com"}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)
Shape
v1.0.0Structure
objectarraydestructive
Description
Shape
Normalize JSON structure with five modes:
- unwrap — Extract the value from a singleton array:
[{obj}]→{obj} - ensureArray — Wrap non-arrays in an array:
{obj}→[{obj}] - flatten — Flatten nested arrays with depth control:
[[a],[b]]→[a,b] - pluck — Extract an element by array index:
[a,b,c]→b - extract — Navigate to a nested path and return that value:
{data:{user:{...}}}→{...}
All modes support Target Paths to scope the operation to specific locations within the document.
Configuration
| Name | Type | Default | Description |
|---|---|---|---|
| Mode | enum | unwrap | unwrap: singleton array to value. ensureArray: wrap non-array in []. flatten: flatten nested arrays. pluck: extract by index. extract: extract nested path. unwrap ensureArray flatten pluck extract |
| Singleton Only | boolean | true | Only unwrap single-element arrays (unwrap mode). When false, always takes the first element. |
| Flatten Depth | number | 1 | How many levels of nested arrays to flatten (flatten mode). Use -1 for infinite depth. |
| Array Index | number | 0 | Index of element to extract (pluck mode). Supports negative indices (-1 = last). |
| Path | string | | Dot-notation path to extract (extract mode). Example: data.user.name |
| Target Paths | path-picker | [] | Scope operation to specific paths only (empty = apply to root) |
Examples
AI Prompt
Unwrap this singleton array into its single value.Output✓
Output✓
1{2 "username": "Morgan",3 "email": "m@test.com"4}Config
Mode
unwrap
Singleton Only
ON
API Usage
POST /api/v1/utilities/structure.shape
Example:
curl -X POST https://your-domain.com/api/v1/utilities/structure.shape \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"inputs":{"primary":[{"username":"Morgan","email":"m@test.com"}]},"config":{"mode":"unwrap","singleton":true}}'Response
1{2 "username": "Morgan",3 "email": "m@test.com"4}