JSON · Converters

JSON → Go

Paste any JSON and get ready-to-use Go structs, with json tags, nested types, slices, and exported field names. Runs entirely in your browser.

JSON in
Go out

JSON into Go structs, instantly

Paste a JSON object and this tool walks it to produce matching Go struct definitions, complete with json:"..." tags so unmarshalling round-trips your original keys. Nested objects become their own named structs, arrays become slices, and field names are converted to exported PascalCase with Go’s common initialisms handled, idID, urlURL, apiAPI.

How types are inferred

  • Numbers become int when every sample is whole, otherwise float64.
  • Arrays become a slice of the merged element type; arrays of objects merge their keys.
  • Mixed or null-only values fall back to interface rather than guessing.
  • Keys missing from some objects in an array become *pointer fields (optional), so a zero value is distinguishable from absent.

FAQ

Why are some fields pointers?

When a key appears in only some objects of an array, it’s emitted as a pointer with omitempty, so an absent value is nil rather than a misleading zero.

Does it handle nested JSON?

Yes, each distinct object shape becomes its own named struct, referenced from the parent. Nesting is unlimited.

Is my JSON uploaded?

No. It’s parsed in your browser, so it’s safe to paste private payloads and it works offline.

Related

Prefer TypeScript? Use JSON → TypeScript. Coming from a spreadsheet? See CSV ⇄ JSON.