← All tools

json-schema-to-zod

Popularity 65 Updated Development & Build

Converts JSON schema objects or files into Zod schemas

npmauto-collected

Installation

npm
npm install -g json-schema-to-zod

Install with npm.

Json-Schema-to-Zod

Notice of deprecation

As of March 2026, this project will no longer be actively maintained.

Thank you to all the contributors and sponsors throughout the years! So long, and thanks for all the fish.

Summary

A runtime package and CLI tool to convert JSON schema (draft 4+) objects or files into Zod schemas in the form of JavaScript code.

Before v2 it used prettier for formatting and json-refs to resolve schemas. To replicate the previous behaviour, please use their respective CLI tools.

Since v2 the CLI supports piped JSON.

Looking for the exact opposite? Check out zod-to-json-schema

Usage

Online

Just paste your JSON schemas here!

CLI

#### Simplest example

npm i -g json-schema-to-zod
json-schema-to-zod -i mySchema.json -o mySchema.ts

#### Example with $refs resolved and output formatted

npm i -g json-schema-to-zod json-refs prettier