The JSON data like the following:
{"xxx_xxx":{"asks":[[0.00000315,1022.53968253],[0.00000328,200],[0.00000329,181.70008541]],"bids":[[0.00000254,2685.36319716],[0.00000253,600],[0.0000025,1000]]}}
the struct as:
type Depth struct {
XXX_XXX struct {
Asks []struct {
Num0 float64 `json:"0"`
Num1 float64 `json:"1"`
} `json:"asks"`
Bids []struct {
Num0 float64 `json:"0"`
Num1 float64 `json:"1"`
} `json:"bids"`
} `json:"xxx_xxx"`
}
when try to map in go-lang as following:
json.Unmarshal(r, &depth)
will get all zero arrays like following:
{{[{0 0} {0 0} {0 0} ] [{0 0} {0 0} {0 0} ]}}
It does not come up the result as I expected. How to solve this problem?
HERE is the code on playground: https://play.golang.org/p/wxFV6Mv26t