Catalog/data-transform-schema-infer

Data Transform

Infer JSON Schema API

Infers a draft-07 JSON Schema from a sample JSON value, merging array item shapes and marking always-present keys as required. Answers 'What JSON Schema describes this sample?', 'How do I generate a schema from example data?'.

Price$0.02per request
MethodPOST
Route/v1/data-transform/schema-infer
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
data-transformjson-schemainferschemadraft-07generatewrangle
API URLhttps://x402.hexl.dev/v1/data-transform/schema-infer
Integration docs
Example request
{
  "sample": {
    "id": 1,
    "name": "x",
    "tags": [
      "a",
      "b"
    ],
    "active": true
  }
}
Example response
{
  "schema": {
    "type": "object",
    "properties": {
      "id": {
        "type": "integer"
      },
      "name": {
        "type": "string"
      },
      "tags": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "active": {
        "type": "boolean"
      }
    },
    "required": [
      "id",
      "name",
      "tags",
      "active"
    ],
    "$schema": "http://json-schema.org/draft-07/schema#"
  }
}
Input schema
{
  "type": "object",
  "required": [
    "sample"
  ],
  "properties": {
    "sample": {
      "type": "object",
      "examples": [
        {
          "id": 1,
          "name": "x",
          "tags": [
            "a",
            "b"
          ],
          "active": true
        }
      ]
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}