From 7b4aeb23539b52e3b0a4e40eb4270460b7b00322 Mon Sep 17 00:00:00 2001 From: AndreasM Date: Fri, 31 May 2013 01:23:23 +0300 Subject: [PATCH] the JSON-RPC 1.0 spec allows the id to be of any type --- jsonapi.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index 853b78e9..1c22aebb 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -12,7 +12,7 @@ import ( // Message contains a message to be sent to the bitcoin client. type Message struct { Jsonrpc string `json:"jsonrpc"` - Id string `json:"id"` + Id interface{} `json:"id"` Method string `json:"method"` Params interface{} `json:"params"` } @@ -24,7 +24,7 @@ type Reply struct { Result interface{} `json:"result"` Error *Error `json:"error"` // This has to be a pointer for go to put a null in it when empty. - Id *string `json:"id"` + Id *interface{} `json:"id"` } // InfoResult contains the data returned by the getinfo command. @@ -618,7 +618,7 @@ func readResultCmd(cmd string, message []byte) (Reply, error) { } // Take care of the parts that are the same for all replies. var jsonErr Error - var id string + var id interface{} err = json.Unmarshal(objmap["error"], &jsonErr) if err != nil { err = fmt.Errorf("Error unmarshalling json reply: %v", err)