How to use
- Paste a JSON sample (for example an API response) into the left panel.
- Set the root type name and choose between
interfaceandtypedeclarations. - The TypeScript definitions update instantly. Nested objects become their own named types.
- When an array contains objects with different keys, missing keys are marked optional (
?).
FAQ
How are arrays of mixed types handled?
Element types are merged: objects are combined into one type with optional fields for keys that are not always present, and different primitives become a union such as (string | number)[].
What happens with null values?
A field that is always null is typed as null. If it is null in some samples and has a value in others, it becomes a union like string | null.
Are invalid identifiers supported as keys?
Yes. Keys such as first-name or 2fa are quoted automatically so the output always compiles.