JSON Schema Generator

Infer a JSON Schema (draft-07) from a sample document — for contract testing and API docs.

Runs 100% client-side
Copy output
On this page4 sections
JSON input
Generated schema
Schema will appear here…

HOW TO USE

  1. 01Paste a representative JSON document — schema is inferred from the structure of this single sample.
  2. 02Toggle Require all keys off if your fields are optional, and Include examples on to embed sample values for documentation.
  3. 03Numbers without decimals are inferred as integer; array items are taken from the first element — review and tighten the result for production use.

WHEN TO USE

Use this when you're onboarding to an undocumented API and need a starting schema to write assertions against, or when a team asks for a schema but none exists yet. Generate a draft in seconds, then manually tighten nullable fields, enum values, and minimum/maximum constraints. Also useful for generating the schema block inside an OpenAPI spec when you have a sample response but no formal definition.

WHAT BUGS THIS FINDS

  • Missing required-field enforcement

    Without a schema, a response that omits a critical field passes deserialization silently — schema validation catches the omission before your test logic ever runs.

  • Wrong type inference

    An ID that happens to be all digits gets inferred as integer; the real API returns it as string — schema review surfaces the mismatch before it breaks a string-based assertion.

  • Undocumented nullable fields

    A field is present in the sample but null in production — schema won't mark it nullable unless you review and adjust, preventing false positives.

  • Schema drift after backend changes

    Regenerating the schema from a fresh response and diffing it against the saved one reveals when the API's shape has changed without a version bump.

QA USE CASES

01

Contract test bootstrap

Generate a schema from a known-good response, save it as a fixture, then validate every future response against it in your contract test suite.

02

OpenAPI spec gap-filling

Paste a sample response to get a schema object you can paste directly into the components/schemas section of an OpenAPI 3.x spec.

03

New API onboarding

Generate schemas for all major endpoints on day one of a new integration, giving the QA team instant validation coverage without waiting for official docs.