About the JSON to TypeScript
Every nested object gets its own named interface, named from its key in PascalCase: profile becomes Profile, and items of a plural array are singularised, so posts gives Post[]. Identical shapes are declared once and reused, and name clashes get a numeric suffix.
Arrays of objects are merged: all elements are combined into one shape. A key missing from some elements is marked optional (scheduledAt?: string), and a key whose type differs between elements becomes a union such as string | number. null values produce | null, an empty array gives unknown[], and keys that are not valid identifiers are quoted.
Options: the root type name, interface or type aliases, the export keyword and readonly properties. The result is inferred from one sample, so review it: a field that happened to be null in the sample is typed null only. Your JSON is processed in the browser.
How to use it
- Paste a JSON sample or open a .json file.
- Set the root name and choose interface or type.
- Toggle export and readonly.
- Copy the TypeScript or download types.ts.