Everything runs on your machine — your file is processed right here in your browser and never uploaded to any server.
Input
JSON
Loading...
Output
Go struct
Loading...

About this tool

Go is statically typed, so consuming a JSON API means declaring a struct that mirrors the payload — and for a response with dozens of fields, typing that struct manually is tedious and error-prone. Paste the JSON here and the equivalent Go struct is written for you, complete with exported field names and json struct tags.

Go developers lean on this when integrating third-party APIs whose docs provide only example responses, and when handling webhook payloads from services like payment providers. A single paste replaces several minutes of careful transcription and eliminates typos that would otherwise surface as silent unmarshaling failures.

How to use

  1. Paste an example JSON response into the left editor, or import one from a file with Load File.
  2. The struct definition materializes in the right editor immediately and re-generates on every keystroke.
  3. Check the field names and types, renaming the struct itself to fit your package's conventions.
  4. Press Copy to drop the code into your Go source file, or Download to save it for later.

No request leaves this page during conversion. The JSON parsing and code generation are performed by scripts running in your browser, so proprietary API responses and webhook payloads stay strictly on your machine.

Frequently asked questions

Are struct tags generated from my JSON keys?

Yes. Each field gets a json tag carrying the original key exactly as it appeared, while the Go field name is converted to exported CamelCase. That way encoding/json can marshal and unmarshal without any manual mapping.

How are Go types selected for each field?

Types are inferred from the sample values: numbers, strings, and booleans map to the corresponding Go types, objects become nested struct types, and arrays become slices of the inferred element type.

What happens when a value is null in my sample?

A null carries no type information, so the field falls back to a generic type. If you know the real type, edit that field afterward — often a pointer type is the right choice for values that may be absent.