Named nested types
Nested objects become their own structs (Address, Order) instead of anonymous structs.
Paste JSON and get idiomatic Go structs with json tags for encoding/json.
Generate Go structs with json tags from JSON. Nested objects become named types, optional fields become pointers with omitempty, and IDs follow Go naming.
{"id":7,"user_name":"aarav","tags":["a"],"address":{"city":"Pune"}}type User struct {
ID int64 `json:"id"`
UserName string `json:"user_name"`
Tags []string `json:"tags"`
Address Address `json:"address"`
}
type Address struct {
City string `json:"city"`
}Tip: Paste several array items rather than one: optional fields can only be detected when some items lack them.
Nested objects become their own structs (Address, Order) instead of anonymous structs.
Fields are exported with Go initialisms: user_id becomes UserID, api_url becomes APIURL.
Fields missing from some array items, or null, become pointers with omitempty.
int64, float64, bool, string, time.Time for RFC 3339 timestamps, and slices for arrays.
Items are merged into one struct named after the singular key (orders → Order); fields missing from some items become optional.
It was null or missing in at least one example, so a pointer lets you tell "absent" from the zero value.
The output uses any for unknown values, which needs Go 1.18 or later.
No, the code is generated in your browser.