go icon indicating copy to clipboard operation
go copied to clipboard

Flatten non embedded fields

Open Daniel63656 opened this issue 5 months ago • 0 comments

I need a way to treat sub-structs as if they are anonymously embedded when marshalling/unmarshalling to json. Is this possible with jsoniter extensions? Couldn't find any documentation on extensions.

Please help

type Entity struct {
    Metadata *Metadata <-- Treat this as if it were just *Metadata during marshal/unmarshal
    UpdatedAt string `json:"/updatedAt"`
    Id        string `json:"/id"`
}

Daniel63656 avatar Aug 11 '25 11:08 Daniel63656