You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

json-schema-to-zod

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-schema-to-zod

Converts JSON schema objects or files into Zod schemas

2.6.1
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created

What is json-schema-to-zod?

The json-schema-to-zod package is a tool that converts JSON Schema definitions into Zod schemas. Zod is a TypeScript-first schema declaration and validation library, and this package helps in bridging the gap between JSON Schema and Zod by automating the conversion process.

What are json-schema-to-zod's main functionalities?

Convert JSON Schema to Zod Schema

This feature allows users to convert a JSON Schema into a Zod schema. The code sample demonstrates how to use the `jsonSchemaToZod` function to transform a JSON Schema object into a Zod schema, which can then be used for validation in a TypeScript environment.

const { jsonSchemaToZod } = require('json-schema-to-zod');

const jsonSchema = {
  type: 'object',
  properties: {
    name: { type: 'string' },
    age: { type: 'number' }
  },
  required: ['name', 'age']
};

const zodSchema = jsonSchemaToZod(jsonSchema);
console.log(zodSchema.toString());

Other packages similar to json-schema-to-zod

Keywords

zod

FAQs

Package last updated on 04 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts