A very simple CLI tool to convert JSON objects or files into zod schemas.
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]
import { jsonToZod } from "json-to-zod"
const myObject = {
hello: "hi"
}
const result = jsonToZod(myObject)
console.log(result)
const schema = z.object({hello: z.string()});