Example
[{"id":1,"name":"Ada"},{"id":2,"age":30}] becomes an interface with id: number, name?: string and age?: number.
Quick answers
Can I get a Zod schema instead?
Yes — switch the mode to JSON → Zod schema.
How to use JSON Converter
- Choose what to convert to: TypeScript, Zod, CSV — or CSV to JSON.
- Paste your JSON (or CSV). The output updates as you type.
- Copy it or download it as a file.
What makes the types accurate
- Looks at every item in an array, not just the first: a field missing from some objects becomes optional (
age?: number), and mixed values become unions (number | string). - Handles
nullas| nullin TypeScript and.nullable()in Zod. - Names nested types from their keys —
ordersbecomesOrder,categoriesbecomesCategory. - Zod output compiles as-is, with schemas declared before they're used and a matching
z.infertype.
CSV details
- Nested objects become dotted columns (
meta.score); every key across all rows gets a column. - Cells starting with
=,+,-or@are escaped so spreadsheets don't run them as formulas. - CSV → JSON detects comma, semicolon or tab delimiters, handles quoted values and line breaks, and keeps codes like
01234as text.
Frequently asked questions
Is my JSON sent to a server?
No. Conversion happens in your browser; nothing you paste is uploaded or stored.
Which Zod version is the output for?
It uses the core API (z.object, z.array, z.union, .optional(), .nullable()) that works in Zod 3 and Zod 4.
My JSON has an error — what now?
Open it in the JSON Formatter, which explains the error and can repair common problems like trailing commas or single quotes.
What does an empty array become?
unknown[] in TypeScript and z.array(z.unknown()) in Zod, because there's nothing to infer from. Paste a sample with at least one item for a precise type.