S SCHEMA.BIZ

Schema Format Converter

Convert between JSON Schema, TypeScript, GraphQL, Zod, Pydantic, and Go structs. Paste your source format on the left and get the converted output instantly on the right.

Input — JSON Schema
1
Output — TypeScript Interface
1

How This Works

All conversions use JSON Schema as an intermediate representation. Your JSON Schema input is first parsed into a JSON Schema, then converted to TypeScript Interface output. This hub-and-spoke approach means every format combination works, though direct conversions may produce slightly different results than format-native tooling. All processing happens in your browser — no data is sent to any server.

JSON SchemaJSON SchemaTypeScript Interface

Convert Between Schema Formats

Modern applications use multiple schema formats across different layers of the stack. Your API might define types in JSON Schema or OpenAPI, your frontend uses TypeScript interfaces, your backend validation uses Zod or Pydantic, and your GraphQL layer has its own type system. Keeping these in sync manually is tedious and error-prone. This converter bridges the gap by translating between formats automatically.

Supported Formats

Input Formats (Source)

  • JSON Schema — The universal schema language. Supports Draft 4 through 2020-12 with $ref, oneOf, allOf, and all standard validation keywords.
  • TypeScript Interface — Parses interface and type declarations with optional properties, union types, literal types, array syntax, and Record types.
  • GraphQL Type — Parses type, input, and enum definitions with standard scalar types and nested references.
  • JSON Example — Infer a schema from a real JSON document. Automatically detects string formats (emails, URLs, dates, UUIDs), handles nested objects, and analyzes arrays for consistent types.

Output Formats (Target)

  • JSON Schema — Standard JSON Schema with proper type annotations, required fields, and format hints.
  • TypeScript Interface — Clean interface declarations with JSDoc comments, optional markers, and proper array/union types.
  • GraphQL Type — SDL type definitions with non-null markers, list types, and enum generation.
  • Zod Schema — Ready-to-use Zod validation schemas with proper chaining (.min(), .max(), .email(), etc.) and inferred TypeScript types.
  • Python Pydantic — Pydantic v2 BaseModel classes with Field() validators, Optional types, and proper Python naming conventions.
  • Go Struct — Go struct definitions with JSON tags, pointer types for optional fields, and proper Go naming conventions.

How It Works: Hub-and-Spoke Architecture

Rather than implementing a separate converter for every possible format pair (which would require 30+ converters for 6 formats), we use JSON Schema as an intermediate representation. Every input format is first parsed into JSON Schema, then the JSON Schema is converted to the target format. This "hub-and-spoke" approach means adding a new format requires only two converters (to and from JSON Schema) instead of one for every existing format.

Common Use Cases

  • API-first development. Define your types once in JSON Schema or OpenAPI, then generate TypeScript types for the frontend, Zod schemas for validation, and Pydantic models for the backend.
  • Migration between languages. Moving from a Python backend (Pydantic) to Go? Convert your models to Go structs as a starting point.
  • Quick prototyping. Paste a JSON example from an API response to instantly generate typed schemas in any format.
  • GraphQL adoption. Convert existing JSON Schema or TypeScript types into GraphQL SDL as a starting point for your schema.

Tips for Better Conversions

Some format-specific features don't have direct equivalents in other formats. For example, Zod's .transform() and .refine() can't be represented in JSON Schema. GraphQL doesn't support free-form objects or additionalProperties. Go doesn't have union types. The converter handles these gracefully by using the closest available equivalent, but you may need to refine the output for production use.

For the best results, start with the most expressive format as your source. JSON Schema is the most feature-rich intermediate format, so conversions from JSON Schema tend to preserve the most information. Use the JSON Schema Validator to verify your schemas before converting, and the OpenAPI Editor to define your API schemas visually.