JSON to TypeScript / Zod / Python / Rust

Turn a JSON sample into TypeScript interfaces, Zod schemas, Python dataclasses or Rust structs, handling nesting, optional fields and naming automatically.

Root type name

Output

Generated code will appear here

Types are inferred from the sample: array elements are merged into their union, and a field missing from some elements becomes optional. Fields that never appear cannot be inferred.

When the root is an array of objects, the element type becomes the root: pasting an array means you want the element shape, not another wrapper.

An empty array gives no element type, so it becomes unknown. Adding one sample item makes the output much more accurate.

Field names follow each language: snake_case for Python and Rust, unchanged for TypeScript. Rust keeps the original key via serde rename so deserialization still works.

Comments

Sign in to join the discussion

No comments yet — be the first to say something