在线 JSON 转 Go Struct 工具,粘贴 JSON 数据自动推断类型并生成带 json tag 的 Go 结构体定义,支持嵌套对象和数组,PascalCase 字段命名。
type Root struct {
Id int `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
IsActive bool `json:"is_active"`
Score float64 `json:"score"`
Tags []string `json:"tags"`
Address Address `json:"address"`
}
type Address struct {
Street string `json:"street"`
City string `json:"city"`
Zip string `json:"zip"`
}