Re: [go-nuts] Re: Unmarshal variable JSON structures

2023-01-03 Thread Fabrice Vaillant
Hello map[string]any might be frustrating if aField or bField are complex since you might want to convert them from any to dedicated struct. I would suggest map[string]json.RawMessage as a possible improvement. It allows delaying the parsing of part of the struct for this kind. However I don

[go-nuts] Re: Unmarshal variable JSON structures

2022-12-29 Thread p...@morth.org
Hi! It's not possible to decode this data without scanning it twice. It's a flawed design where someone has chosen to make that restriction. programming language doesn't matter. The only way to avoid parsing it twice is to decode to a map[string]any and then use that as-is. Which I suppose you