OpenAPI to JSON Schema Converter — Free Online

Extract the components.schemas of OpenAPI 3.0–3.2 documents into JSON Schema. Default output is Draft 2020-12 with $defs, and Draft-07 with definitions is optional. 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). Live convert on paste/sample; explicit Convert (⌘↵) for manual edits; Monaco JSON/YAML input + Shiki JSON output. Empty components.schemas → error. External $ref rejected. Max input 512 KiB.

Options

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

Use cases

Reuse OpenAPI models as standalone JSON Schema. Feed extracted schemas into JSON Schema Validator. Diff schema shapes outside 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 keyword strip that may leave gaps. Default output is Draft 2020-12 ($defs). Choose Draft-07 for a structural remap (definitions plus the Draft-07 $schema), which is not a full keyword rewrite. See Options.

What if there is no Root schema?

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

Related tools?

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

Format, validate, lint and convert OpenAPI, JSON Schema and GraphQL SDL in your browser.