Paste one valid JSON value to infer its current shape.
Objects become structs with json tags; ambiguous sample values use conservative Go types.
Paste one valid JSON value to infer its current shape.
Objects become structs with json tags; ambiguous sample values use conservative Go types.
JSON to Go guide
Paste one valid JSON value into the converter above, choose a root type name, and generate Go declarations for the structure that is actually present. Objects become structs with exported field names and json tags, while nested objects and stable arrays receive named Go types. Everything runs locally in your browser, so copied API responses and fixtures are not sent to a code-generation service. This tool is free to use. No account or payment is required.
Last updated
Each observed object property becomes an exported Go field. Common initialisms such as ID, URL, API, HTTP, JSON, and UUID follow familiar Go naming conventions, while the original key is preserved in a json struct tag for encoding/json.
Nested objects receive deterministic type names derived from the root type and property path. Arrays with one stable observed item shape use a typed slice, including a named item struct when the array contains objects.
One JSON sample cannot prove every production variant. The generator uses int for observed integer numbers, float64 for observed fractional numbers, string and bool for their matching JSON values, and any when the sample does not provide a stable concrete shape.
Generated fields describe the single value you pasted. Review whether production fields can be omitted or null, whether integer widths need int64, and whether strings should become time.Time, custom enums, URLs, decimal types, or other application-specific values.
Parsing and generation happen in the browser. VetaTool does not upload the JSON sample or generated Go source.
A nested profile becomes its own Go type, common initialisms stay idiomatic, and every field keeps the source JSON key.
{
"id": 7,
"profile": {
"website_url": "https://example.com"
},
"roles": ["admin", "editor"]
}type APIResponse struct {
ID int `json:"id"`
Profile APIResponseProfile `json:"profile"`
Roles []string `json:"roles"`
}
type APIResponseProfile struct {
WebsiteURL string `json:"website_url"`
}Common questions
No. JSON parsing, field naming, type inference, and Go source generation run locally in your browser.
Yes. Generated struct fields keep their original JSON keys in json tags so encoding/json can map names such as display-name or website_url back to the source payload.
Observed integers become int and observed fractional values become float64. Review widths and domain-specific numeric types before using generated code in a production contract.
Null becomes any, empty arrays become []any, and arrays containing different observed item shapes become []any because one sample does not provide a safe single concrete type.
No. The first release describes one observed sample and intentionally leaves optionality, date recognition, custom enums, pointers, and richer multi-sample merging for explicit application review.
Debugging a specific JSON issue? Browse JSON troubleshooting.