|
Methanar posted:I want to marshal json into a struct. Given the following json, I've come up with the following struct. But the keys set for tags could actually be anything, not restricted to name or aggregatedBy. How do I represent this in my struct? This will handle arbitrary json fields if you marshal the extra data in tags to that member. Go code:
|
# ¿ Sep 6, 2021 18:41 |
|
|
# ¿ May 11, 2024 23:37 |
|
Methanar posted:So the existence of tags at all is optional. But if it does exist, it's a map of strings with values of also strings. Yeah that should work. Edit: Actually I think using anonymous structs would work better if Tags is omitted, the other way if Tags always exists but can be empty. Go code:
Da Mott Man fucked around with this message at 19:19 on Sep 6, 2021 |
# ¿ Sep 6, 2021 19:02 |