OpenAPI to JSON Schema Converter — Free Online

Extract OpenAPI 3.0–3.2 components.schemas into JSON Schema — default Draft 2020-12 ($defs), optional Draft-07 (definitions). Browser-local, no upload.

Loading…
OpenAPI to JSON Schema documentation
Extract OpenAPI components.schemas into JSON Schema (2020-12 or Draft-07).

Developer notes

• OpenAPI 3.0 schemas convert via @openapi-contrib/openapi-schema-to-json-schema. • OpenAPI 3.1 / 3.2 use a best-effort strip of OAS-only keywords. • Default output: $schema 2020-12 + $defs; optional Draft-07 remap ($schema + definitions + #/definitions refs). • Empty components.schemas → error. • External $ref rejected. • Max input 512 KiB.

Options

Target draft
2020-12 (default) emits $schema + $defs. Draft-07 remaps to the Draft-07 $schema URI, definitions instead of $defs, and #/definitions/… refs — a structural rename only; 2020-12-only keywords are not rewritten.

Use cases

• Reuse OpenAPI models as standalone JSON Schema. • Feed extracted schemas into JSON Schema Validator. • Diff schema shapes outside of a full OpenAPI document.

Examples

OpenAPI YAML → JSON Schema $defs

Before

openapi: "3.0.3" info: title: Pets version: 1.0.0 paths: {} components: schemas: Foo: type: object properties: id: type: string Bar: type: object properties: name: type: string

After

{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$defs": { "Foo": { ... }, "Bar": { ... } } }

Empty schemas rejected

Before

openapi: "3.0.3" info: title: t version: "1" paths: {} components: schemas: {}

After

Error: empty components.schemas

OpenAPI to JSON Schema FAQ

Common questions

Is 3.1 conversion identical to Draft-07?

No. OpenAPI 3.1/3.2 conversion is a best-effort keyword strip. Default output is Draft <strong>2020-12</strong> (<code>$defs</code>). Choose <strong>Draft-07</strong> for a structural remap (<code>definitions</code> + Draft-07 <code>$schema</code>) — not a full keyword rewrite. See Options.

What if there is no Root schema?

All schemas land under <code>$defs</code> (or <code>definitions</code> when Draft-07 is selected) with no invented root type/properties. A schema named Root also gets a top-level <code>$ref</code> to that entry.

Related tools?

Convert the other way with JSON Schema to OpenAPI, or validate the OpenAPI source with Validate OpenAPI.

Looking for converters, encoders, formatters, and minifiers in one place? Developer tools hub Open the curated developer tools catalogue.