Skip to content
yutils
Example

Input (sample JSON)

{
  "id": 1,
  "name": "Alice",
  "active": true,
  "tags": ["admin", "user"]
}

Output (Draft 2020-12 Schema)

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": { "type": "integer" },
    "name": { "type": "string" },
    "active": { "type": "boolean" },
    "tags": {
      "type": "array",
      "items": { "type": "string" }
    }
  },
  "required": ["id", "name", "active", "tags"]
}

Note

Schema inferred from a single sample. Every observed field is marked required — remove optional ones manually, or merge schemas from multiple samples.

Usage / FAQ

When to use

  • Extract a schema from an API response sample (Swagger / OpenAPI starter)
  • Convert existing JSON data to a schema for validation rollout
  • Learn JSON Schema by comparing input and output side-by-side
  • Auto-generate schemas for test fixtures
  • First step in a JSON → ts → schema workflow (pair with json-to-ts)

FAQ

Q.Which Draft is produced?
A.Draft 2020-12 — same as the JSON Schema Validator pair tool. The result includes a `$schema` URL.
Q.Why is every field marked required?
A.Single-sample inference can't tell which fields are optional, so every observed field is required. Remove optional ones manually after generation.
Q.Does it detect format (email, uri, date)?
A.Only base type inference for now — no pattern detection for email / uri / date. Add `format` constraints manually, then verify with the JSON Schema Validator pair tool.