JSON Flattener
Flatten nested JSON into dot-notation keys, e.g. {a:{b:[1,2]}} becomes {'a.b.0':1,'a.b.1':2}. Choose the delimiter and how arrays are handled.
Pay by wallet (x402)
flatten-json Example
Example answer
{
"delimiter": ".",
"flattened": {
"user.age": 30,
"user.name": "John",
"user.address.city": "Stockholm"
},
"key_count": 3,
"array_handling": "index",
"max_depth_found": 3
} Inputs
| Field | Type | Required | What it is |
|---|---|---|---|
data | any | Yes | Nested JSON object |
delimiter | string | No | Default '.' |
array_handling | string | No | 'index' or 'stringify' |
Output fields
How reliably each field appears in a successful answer.
| Field | Type | Appears |
|---|---|---|
flattened | object | Always (present in every successful answer) |
key_count | integer | Always (present in every successful answer) |
max_depth_found | integer | Always (present in every successful answer) |
How to call it
The same tool through each route. MCP clients reach it through Strale’s server at https://api.strale.io/mcp; the call below is what the agent sends.
# Needs an API key. max_price_cents caps what this call may cost.
curl -X POST https://api.strale.io/v1/do \
-H "Authorization: Bearer $STRALE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"capability_slug": "flatten-json",
"inputs": {
"data": {
"user": {
"age": 30,
"name": "John",
"address": {
"city": "Stockholm"
}
}
}
},
"max_price_cents": 2
}' {
"tool": "strale_execute",
"arguments": {
"slug": "flatten-json",
"inputs": {
"data": {
"user": {
"age": 30,
"name": "John",
"address": {
"city": "Stockholm"
}
}
}
},
"max_price_cents": 2
}
} import { Strale } from "straleio";
const strale = new Strale({ apiKey: process.env.STRALE_API_KEY! });
const result = await strale.do({
capability_slug: "flatten-json",
inputs: {
"data": {
"user": {
"age": 30,
"name": "John",
"address": {
"city": "Stockholm"
}
}
}
},
max_price_cents: 2,
}); import os
from straleio import Strale, DoRequest
strale = Strale(api_key=os.environ["STRALE_API_KEY"])
result = strale.do(DoRequest(
capability_slug="flatten-json",
inputs={
"data": {
"user": {
"age": 30,
"name": "John",
"address": {
"city": "Stockholm",
},
},
},
},
max_price_cents=2,
)) # No account. The first request answers 402 with the price in USDC;
# an x402 client pays it from your wallet and repeats the request.
curl -i -X POST https://api.strale.io/x402/v2/flatten-json \
-H 'Content-Type: application/json' \
-d '{
"data": {
"user": {
"age": 30,
"name": "John",
"address": {
"city": "Stockholm"
}
}
}
}' Limitations
Circular references or nesting over 50 levels can fail
Flattens nested objects using dot notation — circular references or extremely deep nesting (>50 levels) may cause errors
What to do instead: Pre-process input to remove circular references and limit nesting depth before flattening
Related tools
- Address Parser €0.05
- Company Industry Classification €0.05
- Company Name Match €0.02
- Credit Score Band €0.02
- CSV Cleaner €0.02
- CSV to JSON €0.02