Tool Kumar tool
JSON to Go
Generate Go struct definitions from a JSON example. Names are converted to exported Go identifiers and tags preserve the original keys.
How to use this tool
- Paste JSON from the response you model.
- Choose Go in the convert view.
- Copy the generated structs into your package and review names.
Worked example
These structs come from the sample JSON and its nested profile object.
Input
{"name":"Ada","age":36,"active":true,"tags":["json","tools"],"profile":{"city":"London"}}Output
package main
type Root struct {
Name string `json:"name"`
Age int64 `json:"age"`
Active bool `json:"active"`
Tags []string `json:"tags"`
Profile Profile `json:"profile"`
}
type Profile struct {
City string `json:"city"`
}
Options and edge cases
- Root and nested type names are inferred from keys.
- JSON tags preserve keys that do not match Go naming.
- Review time, decimal and nullable fields because JSON examples cannot express all domain rules.
Private by default
Your document stays in this browser. Tool Kumar parses, converts and creates downloads on your device, with no account or upload step.
JSON to Go questions
- Does the converter add JSON tags?
- Yes. Each field keeps its source key in a json struct tag.
- How are nested objects handled?
- They become separate named structs referenced by the parent struct.
- Can I change the root name?
- Yes. Set the root name in the converter toolbar.