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

FieldTypeRequiredWhat it is
dataanyYesNested JSON object
delimiterstringNoDefault '.'
array_handlingstringNo'index' or 'stringify'

Output fields

How reliably each field appears in a successful answer.

FieldTypeAppears
flattenedobjectAlways (present in every successful answer)
key_countintegerAlways (present in every successful answer)
max_depth_foundintegerAlways (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
  }'

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