JSON to TypeScript

Turn a JSON sample into TypeScript interfaces or type aliases, with nested types, unions and optional fields.

How it works

  • Nested objects become their own named interfaces; arrays of objects become typed arrays (Tag[]).
  • Mixed values in an array produce a union type, and null is always added as an option.
  • Field names that are not valid identifiers are quoted automatically, and numbers become number.