-
指定json串的key // Field appears in JSON as key "myName". Field int
json:"myName" -
当对应key的值为空的时候,忽略该key // Field appears in JSON as key "myName" and // the field is omitted from the object if its value is empty, // as defined above. Field int
json:"myName,omitempty"
// Field appears in JSON as key "Field" (the default), but
// the field is skipped if empty.
// Note the leading comma.
Field int json:",omitempty"
- 当设置值的key为 “-”,注意是短横线不是下划线,忽略该key
// Field is ignored by this package.
Field int
json:"-"
// Field appears in JSON as key "-".
Field int json:"-,"