What it does
Paste a JSON sample and get ready-to-use TypeScript interfaces or Go structs. It reads the structure of your data and writes one type per object: keys become fields, nested objects become their own named types, and arrays take the type of their first element. The output regenerates as you type and switching language reshapes it instantly.
How the mapping works
- Strings →
string. - Booleans →
boolean(TS) /bool(Go). - Numbers →
number(TS); in Go, a whole number becomesintand one with a decimal part becomesfloat64. - Nested objects → a named type, e.g. a
metaobject yields aMetainterface/struct referenced from the parent. - Arrays → the element type with
[](TS) or[]prefix (Go); an empty array ornullfalls back toany/interface{}.
Field names are kept as-is for TypeScript (quoted if they aren't valid identifiers), while Go gets exported PascalCase names with a json:"..." tag preserving the original key.
Worked example
The input {"id":1,"name":"Ada","tags":["a","b"],"meta":{"active":true}} produces a Meta type with an active boolean and a Root type whose fields are id (number/int), name (string), tags (string array) and meta (the Meta type). In Go each field carries its matching json tag so it round-trips through encoding/json.
Limitations and gotchas
Inference comes from a single sample, so results are a strong starting point rather than a finished schema. The top-level value must be an object, not an array. Optional and sometimes-missing keys all come out required; null values become any/interface{} because the real type is unknowable from null; and mixed arrays are typed from the first element only. Review numbers in Go especially — a field that is 0 in the sample is typed int even if it can hold decimals.
When to use it
Ideal for scaffolding types from an API response or a config file so your editor gets autocompletion and your build catches shape mismatches. Tidy or validate the JSON first with the JSON formatter, or convert from other formats with YAML ↔ JSON and CSV ↔ JSON.
Privacy
Generation is local; nothing is uploaded.