Paste a JSON object, set the root interface name (default: Root), optionally mark all fields as optional, and click Generate. The tool produces export interface declarations for the root object and every nested object it contains, ready to paste into a TypeScript project.
Free, fast, runs in your browser. No login needed.
Root).?..ts file.The generator walks your JSON recursively. For each object it finds, it emits an export interface block. Primitive values map to their TypeScript equivalents: string, number, boolean. null values produce the null type.
Nested interface naming. Nested objects are named by concatenating the parent interface name and the key, separated by an underscore. A Root object with an address key produces a Root_address interface. This naming is functional but not idiomatic TypeScript — you'll likely want to rename these after generation.
Arrays. The generator uses the first element of a non-empty array to infer the item type. An array of objects produces InterfaceName[]. An empty array produces any[]. Mixed-type arrays are not handled — the generated type reflects only the first element.
Optional fields. Checking the Optional checkbox adds ? to every field in every generated interface. Useful when your JSON is a sample that may not include all possible keys in production.
Limits. null fields produce null rather than T | null — you'll want to adjust those manually if the field can hold other types. Date strings stay as string. There is no inference for union types (a field that holds either a string or a number in different records will show as whichever type the sample contains).
Yes. Every nested object gets its own interface declaration. The interfaces are output in order with the root interface first, followed by nested interfaces.
Non-empty arrays use the first element to infer the item type. Empty arrays produce any[]. Arrays with mixed types (e.g., [1, "two", true]) are not supported — the type is inferred from the first element only.
Nested interfaces are named ParentName_keyName — for example, Root_address for an address field under Root. This is functional but not idiomatic. Most TypeScript codebases would name this Address or IAddress. Rename after generating.
Null fields are typed as null, not as T | null. If the field can hold other values in production, update the type manually after generating.
Check the Optional? checkbox before clicking Generate. It adds ? to every field across all generated interfaces.
No. The generator is a custom recursive function built into the tool. It does not invoke tsc or any TypeScript library. The output is a plain text .ts file.