🧰Locly

Convert JSON to TypeScript Types

Convert JSON into TypeScript interfaces or type aliases

About This Tool

JSON to TypeScript turns a JSON sample into interface or type declarations with nested object names. It is an MVP inference helper, not a perfect union-type generator. Conversion is processed locally in your browser.

How to Use

  1. Paste valid JSON
  2. Set the root name and interface/type options
  3. Click Convert
  4. Copy the TypeScript output

Common Use Cases

  • Draft API response types
  • Bootstrap form models
  • Teach JSON shape to TS
  • Quick stubs from fixtures
  • Clean sample payloads

FAQ

Q1: Is JSON uploaded?

No. Conversion is processed locally in your browser.

Q2: Does it support complex unions?

No. Nested objects and arrays are inferred simply; mixed arrays use the first element.

Q3: What if JSON is invalid?

A clear error is shown and no types are emitted.

Q4: Can I export the types?

Yes. Enable Add export to prefix declarations with export.

Related Tools