I'm fairly new to go.
I use this package https://github.com/kdar/httprpc to do my json-rpc v 1.0 requests (as golang only implements 2.0)
I have a problem, this server i'm calling return the "id" as a string, like
"id":"345"
instead of
"id":345
The only way I found was to redefine clientResponse using string instead of uint64
type clientResponse struct {
Result *json.RawMessage `json:"result"`
Error interface{} `json:"error"`
Id string `json:"id"`
}
and to redefine the exacte same DecodeClientResponse function to use my clientResponse
and instead of CallJson, I call (DecodeClientResponse instead of gjson.DecodeClientResponse):
httprpc.CallRaw(address, method, ¶ms, &reply, "application/json",
gjson.EncodeClientRequest, DecodeClientResponse)
I find this quite ugly, is there any way to do better ?
Thanks