I have a json format that looks like this
{
"my_object_list": [
{
"meta": {"version": 1},
"my_value": {// Some complex value
}
}
{
"meta": {"version": 2},
"my_value": {// Some complex value
}
}
]
}
I want to be able to marshal each of the my_value
base on meta
is there a way to achieve that in golang?
type MyResponse struct {
// how to I unmarshal each myObject base on version?
MyObjectList []myObject `json:"my_object_list"`
}