“json:”是什么意思;使“成为”在Golang的Make string的末尾?
我正在编写一些Golang源代码,下面是对程序语法的混淆。 Golang中make字符串末尾的“json:”是什么意思;使“成为”在Golang的Make string的末尾?,go,Go,我正在编写一些Golang源代码,下面是对程序语法的混淆。 Golang中make字符串末尾的json:“make”是什么意思 type Vehicle struct { Make string `json:"make"` Model string `json:"model"` Reg string `json:"reg"` VIN int `json:"VIN"`
json:“make”
是什么意思
type Vehicle struct {
Make string `json:"make"`
Model string `json:"model"`
Reg string `json:"reg"`
VIN int `json:"VIN"`
Owner string `json:"owner"`
Scrapped bool `json:"scrapped"`
Status int `json:"status"`
Colour string `json:"colour"`
V5cID string `json:"v5cID"`
LeaseContractID string `json:"leaseContractID"`
}
标记由编码包使用,如
encoding/json
或encoding/xml
来控制编码和解码期间字段的解释方式。本线程中已经讨论了标记的用法: