【问题标题】:What does mean about the `json:"make"` at the end of Make string in Golang? [duplicate]Golang中Make字符串末尾的`json:“make”`是什么意思? [复制]
【发布时间】:2016-06-08 05:53:35
【问题描述】:

我正在研究一些 Golang 源代码,并且对以下程序语法感到困惑。 Golang中Make字符串末尾的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"`
}

【问题讨论】:

    标签: go


    【解决方案1】:

    encoding/jsonencoding/xml 等编码包使用标签来控制在编码和解码期间如何解释字段。此线程中已经讨论了标签的使用:What are the use(s) for tags in Go?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-16
      • 2015-05-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多