2016-06-08 45 views
-1

我正在研究一些Golang源代碼,並且在程序語法上引起混淆,如下所示。 Golang的Make字符串結尾處的json:"make"是什麼意思?在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"` 
} 

回答

1

標記用於通過編碼包像encoding/jsonencoding/xml控制字段的方式編碼和解碼過程中解釋。本帖已經討論過標籤的用途:What are the use(s) for tags in Go?

相關問題