QiLing Tools

🔷JSON to TypeScript Interface Generator Online - JSON to Go Struct

When integrating an API, paste a sample JSON response and get matching TypeScript type definitions instead of writing interfaces by hand. Nested objects become separate named interfaces (named after the field, with array items singularized), the shapes of multiple array elements are merged, fields missing from some elements are marked optional (?), and mixed arrays become union types. Choose interface or type style and whether to export; switch to the Go tab to generate Go structs with `json:"..."` tags, PascalCase field names and proper ID/URL initialisms. Everything happens in your browser.

Free · No sign-up · Runs in your browserLast updated:

Loading tool...

How to use JSON to TypeScript

  1. 1Paste the JSON (object or array) returned by your API
  2. 2Set the root type name, choose interface / type and export, or switch to Go struct
  3. 3Copy the generated types into your project

FAQ

When is a field marked optional?
When a JSON array contains several objects and a field appears in only some of them, it becomes optional (key?: type). With "Treat null fields as optional" on, fields whose value is null are optional as well.
How are interface names chosen?
The root uses the name you enter; nested objects use the field name in PascalCase (user_profile → UserProfile) and array items are singularized (items → Item). Clashing names get a numeric suffix, and identical shapes share one type.
Are Go numbers int or float?
Integers become int64 and decimals float64; if a field mixes both it becomes float64. Nullable fields become pointer types so you can tell zero values from missing ones.
Is my data uploaded?
No. Everything runs locally in your browser with no network upload and is discarded when you close the page, so it is safe for internal or sensitive data.