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
Case 1
type Structure struct { Id int `json:"id"` *Structure } func TestIssueWithInlineStruct(t *testing.T) { obj := Structure{ Id: 99, } b, err := json.Marshal(obj) assertErr(t, err) assertEq(t, "key a", `{"id":99,null}`, string(b)) // compare with standard library b, err = stdjson.Marshal(obj) assertErr(t, err) assertEq(t, "key b", `{"id":99}`, string(b)) }
Case 2
type AlternativeStructure struct { Id int `json:"id"` *Structure } type Structure struct { Id int `json:"id"` Alternative AlternativeStructure `json:"alternative"` } func TestIssueWithInlineStruct(t *testing.T) { obj := Structure{ Id: 99, Alternative: AlternativeStructure{Id: 123}, } b, err := json.Marshal(obj) assertErr(t, err) assertEq(t, "key a", `{"id":99,"alternative":{"id":123,null}}`, string(b)) // compare with standard library b, err = stdjson.Marshal(obj) assertErr(t, err) assertEq(t, "key b", `{"id":99,"alternative":{"id":123}}`, string(b)) }
When structure in embedded to itself go-json produce invalid json {"id":123,null}
go-json
{"id":123,null}
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Case 1
Case 2
When structure in embedded to itself
go-json
produce invalid json{"id":123,null}
The text was updated successfully, but these errors were encountered: