Assuming different JSON schemas that can all be mapped to a single struct:
{
"amount": 1
}
{
"current_ammount": 1
}
{
"discounted_amount": 1
}
when defining multiple possible JSON tags for a struct field, the subsequent tags are ignored:
type Payable struct {
Amount float32 `json:"amount" json:"current_amount" json:"discounted_amount"`
}
Is there any way to achieve such mapping in such a way that deserialization would be done automatically (without relying on a map[string]any type)?
Without using third party libraries