update json
This commit is contained in:
@@ -7,13 +7,23 @@ import (
|
|||||||
|
|
||||||
type Test struct {
|
type Test struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
Name2 string `json:"name2"`
|
||||||
|
Name3 string `json:"name3,omitempty"`
|
||||||
Age int32 `json:"age"`
|
Age int32 `json:"age"`
|
||||||
|
NotSer string `json:"-"`
|
||||||
|
Bool bool `json:"bool"`
|
||||||
|
BoolInStr bool `json:"bool_in_str,string"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
t := Test {
|
t := Test {
|
||||||
Name: "hatter",
|
Name: "hatter",
|
||||||
|
Name2: "",
|
||||||
|
Name3: "",
|
||||||
Age: 18,
|
Age: 18,
|
||||||
|
NotSer: "not ser!",
|
||||||
|
Bool: true,
|
||||||
|
BoolInStr: true,
|
||||||
}
|
}
|
||||||
s, err := json.Marshal(t)
|
s, err := json.Marshal(t)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user