Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
package main
import (
func main() {
b := []byte(`{"key":"value"}`)
var f interface{}
json.Unmarshal(b, &f)
myMap := f.(map[string]interface{})
Copy link

adpande commented May 9, 2020

Thanks man! You saved my day

Copy link

pagondel commented Sep 2, 2020


Copy link

Chi89 commented Sep 9, 2020

Thank you very much.

Copy link

harsh244 commented Oct 7, 2020

can we not do f.(map[string]string) directly if we know the values are also string?

Copy link

thaison247 commented Dec 22, 2020


Copy link

vishutrilio commented Apr 12, 2021

Thank you so much

Copy link

joechen1105 commented Jul 15, 2021


Copy link

aldlfkahs commented Aug 6, 2021

You saved my life

Copy link

bharathraj-e commented Aug 15, 2021

Simple and saving lives

Copy link

satyamkb commented Sep 28, 2021

Life saver

Copy link

brunotrajano-mm commented Dec 21, 2021

Thanks! It helped a lot

Copy link

ashmilhussain commented Feb 10, 2022

how to do this for a nested data

b := []byte({"key":{"key1":"value"}})

Copy link

vmpastran commented Feb 17, 2022

Merci beaucoup

Copy link

sramac2 commented Feb 17, 2022


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment