refactor:json to struct

This commit is contained in:
李斌
2023-03-21 11:27:46 +08:00
parent 3c506d07c3
commit 6b9ef6780f
3 changed files with 311 additions and 147 deletions

View File

@@ -139,10 +139,10 @@ func TestJsonToStruct3(t *testing.T) {
}
type Student struct {
Name string `json:"name"`
Age int `json:"age"`
Name string `json:"name,omitempty"`
Age int `json:"age,omitempty"`
Address Address `json:"address"`
Scores []Score `json:"scores"`
Scores []Score `json:"scores,omitempty"`
}
jsonStr4 := `{
"name": "Alice",