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
Example code like this:
package main import ( "encoding/json" "fmt" "github.com/json-iterator/go" ) func main() { type S1 struct { F1 string `json:",omitempty"` } type S2 struct { *S1 F2 string `json:",omitempty"` } s1 := &S1{ //F1: "abc", } s2 := &S2{ S1: s1, F2: "123", } b, err := json.Marshal(s2) if err != nil { panic(err) } fmt.Println("Marshalled by json:", string(b)) b, err = jsoniter.Marshal(s2) if err != nil { panic(err) } fmt.Println("Marshalled by jsoniter:", string(b)) }
And the output is:
Marshalled by json: {"F2":"123"} Marshalled by jsoniter: {"F1":"","F2":"123"}
The text was updated successfully, but these errors were encountered:
0ab8806
fix json-iterator#219 should check real value for empty instead of ju…
a1eda13
…st the pointer for nested field
No branches or pull requests
Example code like this:
And the output is:
Marshalled by json: {"F2":"123"}
Marshalled by jsoniter: {"F1":"","F2":"123"}
The text was updated successfully, but these errors were encountered: