Considering I have the following struct
type Product struct {
Price int `json:"price" bson:"price"`
}
However, when I query an external API, the JSON comes in as a String.
[{ "price": "10000"}, { "price": "100"} ]
If i use json.Unmarshal
it will fail because my struct is integer while the JSON is a string.
I set the price as integer because I need to store it in mongodb as integer.
Any solution to this mismatch type issues?