JSON 轉 Go struct 轉換器 — 貼上 JSON 即可生成帶 json 標籤的正確型別 Go struct。處理巢狀物件、陣列和混合型別,欄位以 PascalCase 命名遵循 Go 慣例。 由 ToolNext 免費線上工具箱提供。
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"`
}