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

Given the struct below, why does json.Marshal produce {"user_name":"Sam","Age":0} instead of including the password?

type User struct { Name string `json:"user_name"` Age int Password string `json:"-"` } u := User{Name: "Sam"} b, _ := json.Marshal(u)