如何使键成为标记结构中的增量值?
type Marks struct {
Marks []*Mark `json:"marks"`
}
//Mark структура Словарь марок
type Mark struct {
Mark string `json:"mark"`
SoldPart string `json:"soldPart,omitempty"`
}
你需要这个 JSON:
{
"marks":{
"1":{
"mark":"MDEwMTIzNDU2Nzg5MTIzNTIxMDAwMDAwMDAwMDAwNh0yNDAxMjM0HTEwMDEyMzQ1Njc4OUFC"
},
"2":{
"mark":"MDEwMTIzNDU2Nzg5MTIzNTIxMDAwMDAwMDAwMDAwNx0yNDAxMjM0HTEwMDEyMzQ1Njc4OUFC"
},
"3":{
"mark":"MDEwMTIzNDU2Nzg5MTIzNTIxMDAwMDAwMDAwMDAwOB0yNDAxMjM0HTEwMDEyMzQ1Njc4OUFC"
}
}
}
像这样的东西:
游乐场: https: //play.golang.org/p/TRgaUveMhlR。