3 ms·
Yeah, that's one in my bag-of-JSON-tricks. (Hopefully my bag-of-JSON-tricks gets at least a little less populated with json v2.) This is also useful if you want
by jerf 2y ago
Yeah, that's one in my bag-of-JSON-tricks. (Hopefully my bag-of-JSON-tricks gets at least a little less populated with json v2.) This is also useful if you want to selectively override a particular Unmarshal for any other reason, which is what I needed it for. But then I needed to customize the Unmarshal and back to a top-level type it went. :)
But this sort of thing is why I tried to emphasize at the end that I'm not trying to "ring the alarm bell" or anything. When it works, it works, and it's not like I would call what you have there Bad Code or anything. I personally would have pulled it to a top level type immediately and that's just a preference, not something I'd go to bat over in a code review or anything.