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) } 

example in go playground


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -