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.

[
{
"username": "Morgan",
"email": "m@test.com"
}
]
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.

Read integration guide

Works with:

  • API responses
  • Nested JSON
  • Arrays & objects

Example: input → output

Input / Output
Input
[
{
"username": "Morgan",
"email": "m@test.com"
}
]
Output
{
"username": "Morgan",
"email": "m@test.com"
}

Related tools

Advanced usage (optional)

Shape

v1.0.0
Structure
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

NameTypeDefaultDescription
Modeenumunwrapunwrap: 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 OnlybooleantrueOnly unwrap single-element arrays (unwrap mode). When false, always takes the first element.
Flatten Depthnumber1How many levels of nested arrays to flatten (flatten mode). Use -1 for infinite depth.
Array Indexnumber0Index of element to extract (pluck mode). Supports negative indices (-1 = last).
PathstringDot-notation path to extract (extract mode). Example: data.user.name
Target Pathspath-picker[]Scope operation to specific paths only (empty = apply to root)

Examples

AI Prompt
Unwrap this singleton array into its single value.
[
{
"username": "Morgan",
"email": "m@test.com"
}
]
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}