Skip to content
POST AI agent ready /v1/schema/json-to-jsonschema

JSON to JSON Schema API - Generate draft-07 Schema from Sample

Infers a JSON Schema draft-07 document from the provided value: scalar types map to their schema type, integers get {type: integer}, arrays get {type: array, items: <schema>}, objects get {type: object, properties, required} with every present key in required. Includes $schema reference in the output.

Parameters

objectrequired

JSON value to describe.

Code examples

curl -X POST https://api.botoi.com/v1/schema/json-to-jsonschema \
  -H "Content-Type: application/json" \
  -d '{"json":{"id":1,"title":"Hello"}}'

When to use this API

Bootstrap API documentation

Paste a real response, get a starting JSON Schema, and import into your OpenAPI spec. Removes the tedious step of hand-writing property blocks for every endpoint.

Contract tests against real fixtures

Generate schemas from saved response fixtures and commit them alongside the fixtures. Run /v1/schema/validate in CI to catch any upstream schema drift.

Data-catalog description from samples

For a data warehouse project, describe each table's row shape by sampling one row per table and generating its schema. Auto-document hundreds of tables in minutes.

Frequently asked questions

What draft does the output target?
JSON Schema draft-07. The $schema URI is included so tools can pick the right validator. draft-07 is the most widely supported version across ecosystems.
Are all fields marked required?
Yes. Every key present in the sample is added to the required array. For optional fields, remove them from required manually after generation.
How are arrays described?
{type: "array", items: <schema of first element>}. Empty arrays produce items: {} (any type). For heterogeneous arrays, switch the items to a oneOf manually.
Does it distinguish integer vs. number?
Yes. 42 infers type: "integer"; 3.14 infers type: "number". Follows draft-07 semantics where integer is a constrained subtype of number.
Are enum values inferred?
No. A single string sample produces type:"string", not enum:["value"]. Add enum restrictions manually based on your domain.

Get your API key

Free tier includes 5 requests per minute with no credit card required. Upgrade for higher limits.