
안녕하세요 공부하다가 찾아보니 궁금해서 질문합니다.
type Bird struct {
Species string `json:"birdType"`
Description string `json:"what it does"`
}
struct에 ``안에 있는내용을 어떤걸 뜻하는지 잘 모르겠습니다. 태깅하는건 알겠는데 json이 왜 붙어있는지 잘모르겠습니다.
안녕하세요 공부하다가 찾아보니 궁금해서 질문합니다.
type Bird struct {
Species string `json:"birdType"`
Description string `json:"what it does"`
}
struct에 ``안에 있는내용을 어떤걸 뜻하는지 잘 모르겠습니다. 태깅하는건 알겠는데 json이 왜 붙어있는지 잘모르겠습니다.
좋은 질문입니다.
grave 키가 golang struct에서 아래와 같은 기능을 합니다.
type NetworkInterface struct {
Gateway string `json:"gateway"` IPAddress string `json:"ip"` IPPrefixLen int `json:"ip_prefix_len"` MacAddress string `json:"mac"` ... }
위를 예를들고 gateway 필드는
output 부분을 유심히 봐주세요~
n := NetworkInterface{ Gateway : "foo" } json.Marshal(n)