go - How to Decode map golang -
i run code , map that:
map[from:0 key:<nil> price:desc title:stack]
want value from
,price
,title
please me
once have map constructed, can access value of map providing key. syntax is:
value := mymap[mykey]
the key's type can type can evaluated comparison operator ( >=
, ==
, <=
, etc...). example looks using strings keys.
here's example:
m := map[string]interface{}{ "from": 0, "key": nil, "price": "desc", "title": "task", } // value of price price := m["price"] fmt.println(price) // title title := m["title"] fmt.println(title) // loop through of map's key-value pairs key, value := range m { fmt.println(key, ":", value) }
Comments
Post a Comment