JSON to TypeScript, Zod & Pydantic
Paste a JSON sample and get generated types. Nested objects become named child types, arrays are merged to one element type, and nullable keys become optional. Switch output between TypeScript, Zod, and Python Pydantic.
How type generation works
The generator parses your JSON into a value tree, then builds an intermediate schema. Each object becomes a named interface derived from its key, so profile yields a Profile type. Arrays are reduced to a single element type by merging every element: an array of objects merges key by key, and any key missing from one row is marked optional. Mixed primitive arrays such as [1, "x"] become a union. null values make a field optional or nullable, and whole integers are kept distinct from floats so Pydantic gets int versus float. The Zod and Pydantic targets emit child definitions before the parents that use them. This is a practical scaffold, not a spec-perfect compiler: review names and add real validation before shipping. Feed the output size into the Token Counter or explore the rest of the tools hub.