JSON → Go Struct
Generate Go structs from JSON. Handles nested objects, arrays, and proper json tags with PascalCase field names.
Root struct name
JSON input
Go output
type Address struct {
Street string `json:"street"`
City string `json:"city"`
Zip string `json:"zip"`
}
type Order struct {
Id int `json:"id"`
Total float64 `json:"total"`
Items []string `json:"items"`
}
type Root struct {
Id int `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
Active bool `json:"active"`
Score float64 `json:"score"`
Address Address `json:"address"`
Tags []string `json:"tags"`
Orders []Order `json:"orders"`
Metadata interface{} `json:"metadata"`
}Was this page helpful?