update json

This commit is contained in:
2020-02-10 00:52:30 +08:00
parent c0fae4d5d5
commit ee3c64a3e4

View File

@@ -7,13 +7,23 @@ import (
type Test struct {
Name string `json:"name"`
Name2 string `json:"name2"`
Name3 string `json:"name3,omitempty"`
Age int32 `json:"age"`
NotSer string `json:"-"`
Bool bool `json:"bool"`
BoolInStr bool `json:"bool_in_str,string"`
}
func main() {
t := Test {
Name: "hatter",
Name2: "",
Name3: "",
Age: 18,
NotSer: "not ser!",
Bool: true,
BoolInStr: true,
}
s, err := json.Marshal(t)
if err != nil {