Free JSON to TypeScript — interfaces & type aliases

Convert JSON to TypeScript
interfaces. Nested,
typed, ready to use.

Generate TypeScript interfaces from any JSON sample. Nested objects become separate interfaces, null values become optional fields, arrays get their item type inferred. Runs entirely in your browser.

Your data never leaves your browser
Nested objects → separate interfaces
Null values → optional fields
Arrays → typed arrays
Always free
JSON to TypeScript Generator   100% client-side
Use a representative sample with non-null values for accurate type inference. Null fields become optional (field?: type). No external library — runs on vanilla JS.
JSON input
  TypeScript ready

      
How to convert JSON to TypeScript

Three steps — paste a sample and drop the interfaces into your project.

1
Paste a representative JSON sample

Use a real API response where all fields are present with non-null values. The generator infers types from values — a null field becomes optional (field?: unknown). For best results, use the most complete instance you have available.

2
Set interface name and options

Enter the root interface name (e.g. User, ApiResponse). Choose between interface and type alias output. Toggle readonly for immutable data structures, and enable camelCase conversion if your JSON uses snake_case keys from a backend API.

3
Copy and use in your project

Click Generate and copy the TypeScript interfaces directly into your project — or download as a .ts file. The interfaces are ready to use with fetch(), axios, React state, Redux store or any TypeScript codebase.

How JSON types map to TypeScript

The type inference rules the generator applies to each JSON value.

JSON valueTypeScript typeNotes
"Alice" string All JSON strings become string. Add as const manually for literal types.
42 / 98.5 number Both integers and floats map to number — TypeScript has no separate integer type.
true / false boolean Direct mapping.
null field?: unknown Null in the sample means the actual type is unknown — field becomes optional. Refine manually after generating.
["a", "b"] string[] Item type inferred from first element. Empty array → unknown[].
[{…}, {…}] ChildName[] Array of objects → separate interface + typed array.
{…} ChildName Nested object → separate named interface derived from the key in PascalCase.
When do you need JSON to TypeScript interfaces?

Common front-end and full-stack workflows.

Typing REST API responses

When fetching data from an API in TypeScript, the response is typed as any by default. Generating an interface from a real response sample gives you full autocomplete and type safety for the entire response structure — without writing types by hand.

React state and props

React component props and useState hooks require typed interfaces. Generating from a sample API response or a config object gives you a starting point for the prop or state type — ready to pass to React.FC<Props> immediately.

Database model typing

Prisma, Supabase and Drizzle return query results as typed objects, but sometimes you need to type raw JSON from a jsonb column, a Redis value or a third-party integration. Generating from the actual stored value gives you accurate types.

SDK and client generation

When building a client SDK for an API, you need a TypeScript interface for every request and response shape. Generating from the API documentation examples — or from real responses in Postman — produces an interface file you can ship directly in the SDK package.

Related JSON tools
Popular searches
json to typescript json to ts interface json to typescript interface convert json to typescript json to typescript online json to typescript type generate typescript interface from json json to ts converter json to typescript converter online json to typescript free json to typescript types convert json to typescript interface

TypeScript generated
in your browser. No upload.

The entire interface generation runs in JavaScript locally. Your JSON is parsed and traversed entirely in your browser — it is never transmitted to any server, never stored, and gone the moment you close the tab.

The generated code follows TypeScript conventions: PascalCase interface names, camelCase field names, correct type inference for all JSON value types, and separate named interfaces for nested objects — exactly matching what you would write by hand.

interface and type alias
Choose the output style that fits your project — interface for declaration merging and class implementation, type for union types and mapped types.
Nested interfaces
Each nested object generates a separate named interface — no inline object types. Fully typed from top to bottom, matching TypeScript best practices.
Optional fields from null
Fields with null values in the sample become optional (field?: unknown) — the correct TypeScript pattern for fields that may be absent.
47 tools, always free
No file size limits, no watermarks, no account. Funded by non-intrusive display advertising only.
Frequently asked questions
Common questions about generating TypeScript interfaces from JSON.
How do I convert JSON to TypeScript interfaces?
Paste your JSON sample, set the root interface name, choose your options, and click Generate. The tool infers TypeScript types from your JSON values and outputs complete interface definitions — including nested objects as separate interfaces.
What TypeScript types are inferred from JSON values?
JSON strings become string, numbers become number (both integer and float), booleans become boolean, null becomes optional (field?: unknown), arrays become typed arrays (string[], number[], ChildInterface[]), and objects become separate named interfaces.
Should I use interface or type alias?
Both work for JSON-derived shapes. Use interface if you want to extend the type later with declaration merging or implement it in a class. Use type if you need union types (User | Admin) or mapped types. For API response types, interface is slightly more common by convention.
How are nested JSON objects handled?
Each nested object generates a separate named interface. A user object containing an address object produces a User interface and an Address interface. The parent interface references the child by name. All interfaces are output together so you can drop them into one file.
Is the JSON to TypeScript converter free?
Yes, completely free. No file size limits, no account required. JSONshift is funded by non-intrusive display advertising.
Go up