We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Given the following test:
type Embedded struct { EField string `json:"e_field"` } type myStruct struct { Field string `json:"field"` Embedded } m := myStruct{ Field: "field", Embedded: Embedded{ EField: "e_field", }, } b, _ := jsoniter.Config{OnlyTaggedField: true}.Froze().Marshal(m) fmt.Print(string(b))
Expected: {"field":"field","e_field":"e_field"} Got: {"field":"field"}
{"field":"field","e_field":"e_field"}
{"field":"field"}
Workaround: If I add json:"" tag to embedded, it works:
json:""
type Embedded struct { EField string `json:"e_field"` } type myStruct struct { Field string `json:"field"` Embedded `json:""` } m := myStruct{ Field: "field", Embedded: Embedded{ EField: "e_field", }, } b, _ := jsoniter.Config{OnlyTaggedField: true}.Froze().Marshal(m) fmt.Print(string(b))
The text was updated successfully, but these errors were encountered:
fix json-iterator#308 do NOT skip embedded structs without tag when O…
a9403d2
…nlyTaggedField is set to true
Merge pull request #316 from proemergotech/master
5bc9320
fix #308 do NOT skip embedded structs without tag when OnlyTaggedFiel…
5d7fea6
Merge pull request json-iterator#316 from proemergotech/master
7b68908
fix json-iterator#308 do NOT skip embedded structs without tag when OnlyTaggedFiel…
No branches or pull requests
Given the following test:
Expected:
{"field":"field","e_field":"e_field"}
Got:
{"field":"field"}
Workaround:
If I add
json:""
tag to embedded, it works:The text was updated successfully, but these errors were encountered: