Catalog/data-transform-coerce-types

Data Transform

Coerce types by schema API

Coerces each field of an object to the types declared in a JSON Schema's properties (string<->number<->boolean<->integer) and lists which fields changed. Answers 'How do I cast stringy fields to the right types?', 'How do I coerce form/CSV data to a schema?'.

Price$0.02per request
MethodPOST
Route/v1/data-transform/coerce-types
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
data-transformcoercecasttypesschemajsonwrangle
API URLhttps://x402.hexl.dev/v1/data-transform/coerce-types
Integration docs
Example request
{
  "data": {
    "age": "36",
    "active": "true",
    "score": "9.5"
  },
  "schema": {
    "properties": {
      "age": {
        "type": "integer"
      },
      "active": {
        "type": "boolean"
      },
      "score": {
        "type": "number"
      }
    }
  }
}
Example response
{
  "result": {
    "age": 36,
    "active": true,
    "score": 9.5
  },
  "coerced": [
    "age",
    "active",
    "score"
  ]
}
Input schema
{
  "type": "object",
  "required": [
    "data",
    "schema"
  ],
  "properties": {
    "data": {
      "type": "object",
      "examples": [
        {
          "age": "36",
          "active": "true",
          "score": "9.5"
        }
      ]
    },
    "schema": {
      "type": "object",
      "examples": [
        {
          "properties": {
            "age": {
              "type": "integer"
            },
            "active": {
              "type": "boolean"
            },
            "score": {
              "type": "number"
            }
          }
        }
      ]
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}