Free · No sign-up · Runs in browser

JSON Schema Generator

Infer a Draft 2020-12 JSON Schema from any sample JSON. Perfect for OpenAPI, config validation, GraphQL input types, and documenting legacy APIs.

Sample JSON
JSON Schema
// JSON Schema will appear here…

JSON Schema Generator

Infer a JSON Schema (Draft 2020-12) from a sample payload. The generator detects object properties, array item types, required fields, and distinguishes integer vs number. Perfect for drafting OpenAPI specs, Ajv/zod validators, or documentation for legacy JSON APIs.

Inference Rules

  • Objects → type: "object" with properties and all keys required
  • Arrays → type: "array" with merged items schema
  • Numbers → integer if the value is whole, else number
  • Mixed types across array elements collapse into a union

FAQ

Is the output valid for Ajv?

Yes — Draft 2020-12 is the current spec; Ajv 8+ supports it.

Related

Generate TypeScript interfaces instead, or compare JSON with JSON Diff.

Draft 2020-12

Output is validated against the current JSON Schema spec.

Smart inference

Merges array item types, splits integer vs number.

Fully private

JSON stays in your browser.