am having some troubles unmarshalling some content into a struct object in go. Basically, my struct is defined as:
type TheParam struct {
Id string `json:"id,string"`
Provider string `json:"provider,string"`
}
Now, I have one variable with the bytes, if I make fmt.Print(string(data)) then I get:
"{\"id\":\"some-id\",\"provider\":\"any-provider\"}"
An example of he data in bytes is:
34 123 92 34 105 100 92 34 58 92 34 103 105 116 104 117 98 45 100 97 115 104 45 97 99 99 101 115 115 92 34 44 92 34 112 114 111 118 105 100 101 114 92 34 58 92 34 103 105 116 104 117 98 92 34 125 34
And, am making the unmarshalling with:
if err = json.Unmarshal(data, &myParam); err != nil {
redisLogger.WithError(err).Error("unmarshalling into interface")
}
So, now am getting: json: cannot unmarshal string into Go value of type TheParam. What am I missing?