What is a JSON to Go converter?
Hand-writing structs for an API response is slow and error-prone. This tool infers Go structs from a JSON sample: nested objects become named types, arrays become typed collections, and null/missing values become optional fields. It runs quicktype's inference engine entirely in your browser, so real API payloads (often containing user data or credentials) never leave your machine.
Go mapping notes
- Every field gets a
json:"…"tag preserving the original key, with Go-style exported names. - Nullable fields become pointers (
*string) sonullround-trips. - JSON integers map to
int64; floats tofloat64.
How to use
- Paste a JSON sample (an API response works well) into the Input pane.
- Generated Go structs appear instantly. Nested objects become their own named types.
- Non-standard JSON (single quotes, trailing commas, comments) is auto-repaired first.
- Copy the code into your project.
Examples
JSON → Go structs
{
"id": 42,
"name": "workbench",
"owner": { "email": "[email protected]", "active": true }
}type Root struct {
ID int64 `json:"id"`
Name string `json:"name"`
Owner Owner `json:"owner"`
}FAQ
How do I convert JSON to Go types?
Paste any JSON sample. The structs are inferred from the values and nesting, entirely in your browser. Nothing is uploaded.
How are nested objects handled?
Each distinct nested object becomes its own named type, referenced from the parent, arrays of objects included.
What about optional or null fields?
Fields that are null or missing in parts of the sample are typed as optional/nullable in the generated code.
Can I paste multiple samples?
Paste an array of objects: the type is inferred from the union of all items, which catches optional fields a single sample would miss.
Why are some fields pointers?
A field that is ever null (or missing) in the sample becomes a pointer so encoding/json can distinguish absent from zero-value.
Is my JSON uploaded?
No. Generation runs 100% in your browser via quicktype's engine. Check DevTools: zero network requests.