JSON to TypeScript Interface Generator
Generate clean TypeScript interfaces from JSON in one paste, including nested objects, arrays and optional fields.
How to convert JSON to TypeScript interfaces
- Paste the JSON you get from an API, a database or a config file.
- Name the root type, for example
UserorApiResponse. - Copy the interfaces or download them as a
.types.tsfile.
Nested objects become their own named interfaces, so the result stays readable even for large responses.
What the generator handles
| JSON | TypeScript |
|---|---|
"name": "Aarav" |
name: string; |
"age": 27 |
age: number; |
"tags": ["ai", "seo"] |
tags: string[]; |
"items": [1, "a"] |
items: (number | string)[]; |
| Nested object | A separate exported interface |
| Field missing in some array items | An optional field, such as repo?: string; |
Field that is sometimes null |
string | null |
Types are not validation
Writing const user: User = await res.json() tells TypeScript to trust the data, but nothing checks it when the code runs. For data from outside your app, such as API responses, form posts and webhooks, generate a Zod schema from the same JSON with the JSON to Zod tool and validate it first.
Frequently asked questions
Interface or type: which one does it output?
Objects become interface declarations because they are easy to extend. A top-level array becomes a type alias, such as export type UserList = User[];.
Is my data safe?
Yes. The generator runs in your browser and never uploads your JSON.
Why is a date typed as string?
JSON stores dates as text, so the parsed value really is a string. Convert it with new Date(value) where you need a Date.
More free tools
-
JSON to Mongoose Schema Converter
Paste a JSON document and get a ready-to-use Mongoose schema and model, with nested schemas, ObjectId refs and timestamps.
-
JSON to Zod Schema Generator
Turn any JSON into a Zod schema plus its TypeScript type, ready to validate API responses and form data.
-
SQL to MongoDB Query Converter
Convert SQL queries to MongoDB find(), aggregate(), updateMany() and more, for mongosh or Mongoose.
-
PAN, Aadhaar, GST and IFSC Validator
Check PAN, Aadhaar, GSTIN, IFSC, PIN code, mobile and UPI formats, with real checksum tests and copy-ready regex.
-
MongoDB Connection String Checker and Builder
Find what’s wrong with a MongoDB URI, from unencoded passwords to SRV ports, or build a correct one for Atlas or a local server.
-
MongoDB ObjectId to Timestamp Converter
See when any MongoDB document was created from its _id, or turn a date into an ObjectId for fast range queries.
