JSON to TypeScript
Turn a JSON sample into TypeScript interfaces or types, with nested types, unions and optional keys worked out for you.
Questions
How are optional keys decided?
When an array holds several objects, a key that is missing from some of them is marked optional with a question mark. Turn this off to make every key required.
What does it do with mixed values?
Values of different types under the same key become a union such as string | null. Empty arrays become unknown[] because the sample does not say what they hold.
Does it guess dates or enums?
No. It types what JSON can express: strings, numbers, booleans, null, arrays and objects. A date string stays a string.