Skip to content
Run here 100% in your browser, no upload, no login

JSON to Go

Convert JSON into Go struct types with exported fields, json tags, nested structs and slice typing.

How to use it

  1. Paste your JSON into the left panel — a sample loads on start.
  2. Set the root type name; nested structs are named from their field paths.
  3. The output lists nested structs and puts the root struct at the bottom; copy it into your package.
  4. Field names are exported (PascalCase) so encoding/json can see them, with a json:"original_key" tag each.
  5. Name conflicts get numeric suffixes; tabs match gofmt layout.

Common use cases

Why it stays private

Conversion is local string work — no upload, no telemetry. It is safe for internal payload shapes and unreleased API designs.

FAQ

Q: How are numbers typed? A: All JSON numbers become float64, which is what encoding/json uses by default. Change to int or float32 manually where you know the domain.

Q: What happens with mixed or empty arrays? A: A single element type produces []T; elements of several different types, or an empty array, degrade to []any since the shape cannot be pinned down from the data alone.

Q: Why did my field get a different name than the JSON key? A: Go field names must be exported and valid identifiers, so keys are converted to PascalCase while the original key stays in the json tag — decoding still matches the wire format exactly.

Your data stays on this device

JSON to Go runs 100% locally. Everything you paste or drop is processed by your own browser and never transmitted. Nothing is stored on our servers — close the tab and it is gone.

Nothing you type is sent to a server, logged, or used for analytics. The page works even with your network disconnected after first load.