Allow marshaling/unmarshaling of non-anonymous structs and interfaces to embed fields in json, equivalent to how anonymous structs are embedded
type Foo struct {
S string
}
type Bar struct {
I int
F Foo `json:",unwrapped"`
}
func main() {
var b Bar = Bar{F: Foo{S: "abc"}, I: 123}
e, _ := json.Marshal(b)
fmt.Println(string(e))
}
expected output
{ "S": "abc", "I": 123}
The text was updated successfully, but these errors were encountered:
Allow marshaling/unmarshaling of non-anonymous structs and interfaces to embed fields in json, equivalent to how anonymous structs are embedded
expected output
The text was updated successfully, but these errors were encountered: