How can I map each element to struct or map. Base on the json data that has different types.
{
profile: {
execution_time: 34,
server_name: "myServer.net"
},
result: "ok",
ret: [
{
alias: "asda444444",
all_parents: [
123,
2433369,
243628,
2432267,
62
],
bankrupt: false,
block: false,
card: null
}
]
}
I had tried this already. But not work as expected.
var o map[string]interface{}
err := json.Unmarshal(data, &o)
if err != nil {
revel.INFO.Println("Json Decode Error", err)
}
fmt.Println(o)
By this way, I can only get o["ret"]. What I really want is o["ret"]["alias"] or o["ret"]["all_parents"].
Any suggestions or tips will helps. Thanks.