package main import ( "encoding/json" "fmt" ) type SomeStruct struct { A string `json:""` B string `json:"-"` C string `json:"cake"` D string `json:"dog,omitempty"` E string `json:",omitempty"` } func main() { s := SomeStruct{"A", "B", "C", "", "E"} result, _ := json.Marshal(s) fmt.Println(string(result)) // ?? }