Skip to content

Instantly share code, notes, and snippets.

@danslimmon
Created May 7, 2015 21:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danslimmon/1111df1c9613bc8483dd to your computer and use it in GitHub Desktop.
Save danslimmon/1111df1c9613bc8483dd to your computer and use it in GitHub Desktop.
x := map[string]{interface}{
"blah": "foop",
"shmerp": []interface{}{
map[string]interface{}{
"hey": 1,
"yes": 2,
},
map[string]interface{}{
"alpha": 3,
"bravo": 4,
},
},
}
// Versus
func json2map(j string) map[string]interface{} {
rslt := make(map[string]interface{})
json.Unmarshal([]byte(j), &rslt)
return rslt
}
x := json2map(`{
"blah": "foop",
"shmerp": [
{
"hey": 1,
"yes": 2
},
{
"alpha": 3,
"bravo": 4
}
]
}`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment