OpenAPI to JSON Schema

Runs in browser

Extract JSON Schemas from OpenAPI 3.x or Swagger 2.0 specs.

Convert OpenAPI 3.x or Swagger 2.0 schemas to standard JSON Schema draft-07. Paste YAML or JSON spec and extract individual or combined schemas. Runs in your browser.

OpenAPI to JSON Schema tool

2 schemas found:
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "required": [
    "id",
    "name"
  ],
  "properties": {
    "id": {
      "type": "integer"
    },
    "name": {
      "type": "string"
    },
    "email": {
      "type": "string",
      "format": "email"
    }
  }
}
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "definitions": {
    "User": {
      "type": "object",
      "required": [
        "id",
        "name"
      ],
      "properties": {
        "id": {
          "type": "integer"
        },
        "name": {
          "type": "string"
        },
        "email": {
          "type": "string",
          "format": "email"
        }
      }
    },
    "Error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "integer"
        },
        "message": {
          "type": "string"
        }
      }
    }
  }
}

🔒 Runs in your browser · No uploads · Your data never leaves your device

How to use

  1. Paste spec

    Paste an OpenAPI 3.x or Swagger 2.0 spec in YAML or JSON format.

  2. Select a schema

    Click a schema name tab to see its JSON Schema draft-07 output.

  3. Copy or use combined

    Copy individual schemas or the combined output with all definitions.

Common use cases

  • Extracting schemas for validationPull individual component schemas from an OpenAPI spec to use as standalone JSON Schema validators.
  • Generating TypeScript types from OpenAPIExtract JSON Schema from an OpenAPI spec as an intermediate step before generating TypeScript interfaces.

Examples

  • User schema from OpenAPI

    Extract User schema from a simple OpenAPI spec.

    Output
    {"$schema": "http://json-schema.org/draft-07/schema#", "type": "object", ...}

Frequently asked questions

What formats are supported?
YAML and JSON. The tool detects JSON when input starts with { and falls back to YAML.
Is my spec uploaded?
No. All conversion runs in your browser using the yaml package.

Key concepts

OpenAPI components
The reusable schema definitions section of an OpenAPI spec (components/schemas), which contain JSON Schema-like object definitions.

You might find these useful too.

More api tools