I am writing a client server go application which uses yahoo finance api to fetch the real time stock price. I am using jsonrpc package to connect client and server. I am unable to pass a nested map response from server to client. Here is my small snippet from the client file. client.go file
var (
reply map[string]map[int]float64
)
c := jsonrpc.NewClient(client)
err = c.Call("JSONResponse.GetStockValue", args, &reply)
fmt.Println(reply)
Server file looks like this:
func (j *JSONResponse) GetStockValue(args *ClientRequest, reply *map[string]map[int]float64) error {
some piece of code......
nestedMap := make(map[string]map[int]float64)
add some values in nested map .....
fmt.Println(nestedMap)
*reply = nestedMap
return nil
}
This does not send any response to the client. When i change the nested map to simple map like map[string]int, it correctly works. The nested map is correctly displayed at server but does not get displayed on the client side. The client simply keeps on waiting for the response from the server. It would be very helpful if someone could guide me on why it is not accepting a nested map and working fine for a simple map ?
Thanks :)