Skip to main content
Journey Uncommon Logo
JourneyUncommon
easyGostructs and tagsSingle-choice MCQ

What does the `omitempty` option do here when the field is its zero value?

type Item struct { Name string `json:"name"` Count int `json:"count,omitempty"` } b, _ := json.Marshal(Item{Name: "box"}) fmt.Println(string(b))