D/F DevFormat.tools
Type Generators Runs locally

JSON → Go Struct converter

Convert JSON objects into typed Go structs instantly in your browser. Free, private, and no signup required.

Paste your source, then convert it locally.

Private · browser only

Your data stays in this browser. Nothing is uploaded.

Conversion directions

Direction 01

JSON to Go Struct

Generate typed Go structs with JSON field tags.

About this converter

Generating Go structs from JSON

Paste a JSON object and the converter emits a set of typed Go structs, one per nested object, with field names exported in PascalCase and json tags that preserve the original keys. This matches the convention used by the encoding/json package, so the generated code deserializes your payload without extra mapping.

Arrays become slices, nested objects become referenced struct types, and null values are handled with pointer or omitempty-friendly tagging.

Type inference rules

Numbers become float64 by default, the type encoding/json uses during generic decoding. Booleans map to bool, strings to string, and arrays to []T. When you need int or a specific width, adjust the generated field type after pasting.

Integrating with your Go project

Copy the generated structs into a models package and pass a value of the root struct to json.Unmarshal. Because the json tags match your API keys exactly, you avoid manual field-by-field mapping and can evolve the types as the schema changes.

Frequently asked questions

Does this JSON to Go converter upload my data?

No. Conversion runs entirely in your browser, so your JSON never leaves your device.

How are nested objects handled?

Nested JSON objects become named Go structs and arrays receive inferred element types.

What Go types are inferred?

Strings map to string, numbers to float64, booleans to bool and arrays to slices. Nested objects become referenced struct types with json tags.

Does it generate json tags?

Yes. Each field gets a json tag that preserves the original JSON key, so encoding/json deserializes your payload without manual mapping.

Can I use the structs with encoding/json?

Yes. Pass a value of the root struct to json.Unmarshal and the tags handle the key mapping automatically.