JSON to TypeScript
Paste a JSON response and get typed models: nested objects become their own types.
export interface Root {
id: number;
name: string;
active: boolean;
score: number;
tags: string[];
address: Address;
posts: Post[];
}
export interface Post {
id: number;
title: string;
pinned?: boolean;
}
export interface Address {
city: string;
zip: string;
geo: Geo;
}
export interface Geo {
lat: number;
lng: number;
}
- Typing a third-party API response the moment you first call it
- Generating Go structs with correct json tags for a backend integration
- Creating a Zod schema to validate an untrusted webhook payload
- Turning a fixture file into Python dataclasses for a test suite
Free and private. Everything runs on your own device, with no account and no uploads.
Wiring up a new API endpoint usually starts with the same chore: reading a sample JSON response and hand-typing an interface that matches it, field by field. This tool does that for you. Paste any JSON payload and get TypeScript interfaces, a Zod schema, Go structs or Python dataclasses, with nested objects promoted into their own named types and arrays of objects merged so a field missing from one row is marked optional instead of silently dropped. Everything is generated in your browser, so production payloads never leave your machine.
For an array of objects, every key is checked against every element. A key that is missing from at least one element is marked optional: `field?:` in TypeScript, `.optional()` in Zod, a pointer with `omitempty` in Go and `Optional[...] = None` in Python.
Each nested object becomes its own named interface or struct, named after the key that holds it, so you get a readable set of types rather than one deeply inlined blob.
A field that is null in the sample cannot be typed accurately, so it is emitted as `null` in TypeScript and `interface{}` / `Any` in Go and Python. Give the tool a sample where the field is populated for a more precise type.
Yes. It emits one schema per object plus matching `z.infer` types, so you get both runtime validation and static types from a single source.
- 1
Paste a JSON sample
Drop in a real API response: an object, or an array of objects.
- 2
Name the root type
Set the name for the top-level type, such as User or ApiResponse.
- 3
Pick your target
Switch between TypeScript, Zod, Go and Python output.
- 4
Copy into your project
Copy the generated code straight into your types file.
- ·Feed it the largest sample you have: more rows means better optional-field detection and fewer wrong types.
- ·If a numeric field is sometimes a whole number and sometimes a decimal, check the Go output, which picks int or float64 from the single sample value you gave it.
- ·Rename the root type before copying; a good name at the top propagates into how readable the nested types are.