Paste JSON
Upload File

Click to select or drag & drop a .json file

What the generator decided

Paste or upload JSON to see every type decision laid out — which field became which Go type, which key was renamed because it was not a valid identifier, and which array was inferred as a concrete struct versus []interface{}.

All generation runs in your browser. Your JSON is never uploaded to any server.

JSON to Go Converter

Turn any JSON into Go struct definitions directly in your browser — no upload, no API call, no tracking. Paste JSON (or drop a .json file) and get Go structs with nested types, slices, json struct tags, and a full type-decision report that shows exactly how each field was inferred.

What it generates

Why the report matters

Most generators hand you a struct and stay silent about the guesses. This one doesn't. For every field it tells you the inferred type. For every key it shows what happened. For every array it tells you whether the element type was pinned to a concrete struct or fell back to []interface{}. That is the difference between a struct you can trust and one that quietly unmarshals wrong.

Using the output

Copy the code into a .go file in your package and unmarshal with the standard library:

The json tag on each field preserves the original key, so the struct matches your JSON even when the Go field name differs.

How inference works (and its limits)

Array element types are inferred from the first element of each array; if the elements have differing shapes, the array falls back to []interface{} and the report says so. Type choices reflect the sample you provide — feed it a representative payload.

FAQ

Is this JSON to Go converter free?

Yes. It runs entirely in your browser, with no login, no usage limits, and no ads on this tool. Your JSON never leaves your device.

Is my JSON data safe?

Yes. All code generation happens locally in JavaScript. Your JSON is never sent to a server, logged, or stored. You can disconnect from the internet after the page loads and it will still work.

Why are field names capitalized?

Go only serializes exported struct fields, so field names are capitalized (e.g. first-name becomes FirstName). The original key is preserved in the json tag, so nothing is lost on the wire. The report lists every name that changed.

How are numbers typed?

Integers that fit in 32 bits become int; larger integers become int64. Decimal values become float64. If you need exact decimals for money, change the field to json.Number or a decimal type after generating.

How are arrays handled?

An array of objects becomes []ElementStruct. An array of primitives becomes []string, []int, etc. If the array's elements have different shapes, it becomes []interface{} — the report flags this so you know the type was not pinned down.

Can I convert Go back to JSON?

This tool goes JSON → Go. For the reverse direction, use the CSV to JSON converter for tabular data, or your editor's JSON support for hand-written structs.