Add valid JSON
Paste an object or array, or open a local .json file. Representative records produce more accurate field types.
Generate clean, idiomatic Go structs from real JSON data. Infer nested objects, slices, numeric types, nullable pointers, exported field names, and exact JSON tags locally.
Create reusable Go data models in three focused steps.
Paste an object or array, or open a local .json file. Representative records produce more accurate field types.
Name the root struct and choose whether nullable or missing fields should use Go pointer types.
Review the generated structs, copy them into your project, or download a formatted .go source file.
The generator examines complete structures and produces readable Go models with accurate serialization tags.
Objects inside objects receive clear named struct definitions instead of generic maps.
JSON arrays become typed Go slices, including slices of generated object structs.
Every exported field receives a backtick JSON tag preserving the original property name.
Your JSON is parsed and converted inside the browser without a server upload.
Strings become string, whole numbers become int64, decimals become float64, booleans become bool, arrays become slices, and nested objects become named structs.
When enabled, values that are null or keys missing from some array records receive pointer types and omitempty tags. Unknown null-only values use interface{}.
Go requires uppercase field names for JSON marshaling. The generator creates safe exported identifiers while the JSON tag preserves spaces, hyphens, snake_case, and other original keys.
// JSON { "id": 42, "name": "Alex", "roles": ["admin", "editor"] } // Go type Root struct { ID int64 `json:"id"` Name string `json:"name"` Roles []string `json:"roles"` }
Practical details about fields, slices, pointers, tags, and generated code.
Yes. Nested objects become named Go structs and arrays of objects become typed slices.
All sample values are inspected. Compatible values produce a typed slice, while incompatible mixed values use []interface{}.
A known nullable value can use a pointer such as *string or *int64. A null-only value becomes interface{} because its concrete type is unknown.
Go JSON encoders can only access exported struct fields, which must begin with an uppercase letter.
Yes. The Go field is converted to a safe exported name and the original key remains in its JSON tag.
An empty array contains no type evidence, so the converter generates []interface{}.
No. Parsing, type inference, copying, and downloading happen locally in your browser.
Yes. The structs describe the supplied sample. Compare them with your API contract before production use.