I have a problem with unmarshaling JSON response from one of the APIs. API returns an array of simple objects. It has a structure:
"dataFields": [
{
"key": "Example_key1",
"value": "Example_value3"
},
{
"key": "Example_key2",
"value": "Example_value3"
},
{
"key": "Example_key3",
"value": "Example_value3"
}
]
Generally, there are always 2 strings (possibly a null instead of a string, but this is not a problem).
Unfortunately, recently the provider has introduced a new field that looks like this:
{
"key": "Example_key4",
"value": false
}
Now I can not unpack it to a simple unmarshal to the structure I used before:
type DataField struct {
Value string `json:"value,omitempty"`
Key string `json:"key,omitempty"`
}
Can you suggest to me how you can unpack something like that?
Thank you in advance