Tools

JSON to TypeScript, Zod and JSON Schema

Paste an API response or any JSON example. Get TypeScript interfaces, a Zod schema or a JSON Schema, with optional fields worked out from arrays.

Result

How it works

  • Merged arraysEvery item in an array is read, so a field that only some items have becomes optional, and mixed types become unions.
  • Named typesNested objects get their own interfaces, named after their keys. Array items are named in the singular.

Questions

Does it handle dates?

JSON has no date type, so dates come out as strings. Add z.string().datetime() in Zod if you want them checked.

Is my JSON uploaded?

No. It is converted in your browser.

More tools

Built something with it?

Show it in the server, get a code review, or ask the people who use these tools every day.

Join on Discord