Catalog/data-transform-flatten

Data Transform

Flatten nested object API

Flattens a nested object/array into single-level keys using dot (a.b.0) or bracket (a.b[0]) notation, preserving empty containers. Answers 'How do I flatten nested JSON into dotted keys?', 'How do I turn a tree into a flat key/value map?'.

Price$0.01per request
MethodPOST
Route/v1/data-transform/flatten
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
data-transformflattenjsondot-notationnestedwranglekeys
API URLhttps://x402.hexl.dev/v1/data-transform/flatten
Integration docs
Example request
{
  "object": {
    "a": {
      "b": 1,
      "c": [
        2,
        3
      ]
    }
  }
}
Example response
{
  "result": {
    "a.b": 1,
    "a.c.0": 2,
    "a.c.1": 3
  },
  "keys": [
    "a.b",
    "a.c.0",
    "a.c.1"
  ]
}
Input schema
{
  "type": "object",
  "required": [
    "object"
  ],
  "properties": {
    "object": {
      "type": "object",
      "examples": [
        {
          "a": {
            "b": 1,
            "c": [
              2,
              3
            ]
          }
        }
      ]
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}