Paste one valid JSON value to infer its current shape.
Object samples become exported interfaces; arrays and primitive roots use exported type aliases.
Paste one valid JSON value to infer its current shape.
Object samples become exported interfaces; arrays and primitive roots use exported type aliases.
JSON to TypeScript guide
Paste one valid JSON value into the generator above, choose a root type name, and create exported TypeScript declarations that describe the observed object, array, primitive, and null shapes. Generation runs locally in your browser, so copied API responses and fixture data are not sent to a code-generation service. This tool is free to use. No account or payment is required.
Last updated
Non-empty objects become exported interfaces. Nested objects receive deterministic names derived from the root type and property path, while property names that are not valid TypeScript identifiers remain safely quoted.
Homogeneous arrays use one item type. Mixed arrays use a union, empty arrays use unknown[], and arrays of objects generate reusable item interfaces instead of inline anonymous object literals.
A single JSON document cannot prove whether a field is optional, whether a string represents a date, or whether multiple response variants exist. This release intentionally describes the value that was pasted instead of inventing those business rules.
Generated declarations are a development starting point, not proof of every production response shape. Compare representative payloads, mark genuinely optional fields, and replace broad or sample-specific types where your application has stronger knowledge.
The input is parsed and converted in the browser. VetaTool does not upload the sample JSON or generated TypeScript.
A nested profile becomes its own interface, a string array becomes string[], and a property containing a hyphen remains quoted.
{
"id": 1,
"profile": {
"display-name": "Ada"
},
"roles": ["admin", "editor"]
}export interface ApiResponse {
id: number;
profile: ApiResponseProfile;
roles: string[];
}
export interface ApiResponseProfile {
"display-name": string;
}Common questions
No. JSON parsing, type inference, naming, and code generation run locally in your browser.
Not in this first release. Every property observed in the single sample is emitted as required because one document cannot prove optionality.
Distinct observed item types become a TypeScript union. Different object shapes receive stable numbered item interface names for review.
Empty objects become Record<string, unknown>, while empty arrays become unknown[] because the sample provides no item evidence.
No. Strings remain strings in this release. Date recognition, optional-field inference, and richer multi-sample merging are separate reviewable features.
Debugging a specific JSON issue? Browse JSON troubleshooting.