json-to-zod
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published

Json-to-Zod

Summary

A very simple CLI tool to convert JSON objects or files into zod schemas.

Usage

CLI

json-to-zod -s myJson.json -t mySchema.ts

Options:

  • --source/-s [source file name]
  • --target/-t [(optional) target file name]
  • --name/-n [(optional) schema name in output]

Programmatic

import { jsonToZod } from "json-to-zod"

const myObject = {
    hello: "hi"
}

const result = jsonToZod(myObject)

console.log(result)

Expected output:

const schema = z.object({hello: z.string()});

Readme

Keywords

Package Sidebar

Install

npm i json-to-zod

Weekly Downloads

1,041

Version

1.1.2

License

ISC

Unpacked Size

8.18 kB

Total Files

9

Last publish

Collaborators

  • stefan-terdell
  • renatosinohara