Skip to content

Instantly share code, notes, and snippets.

@lucacervasio
Created August 8, 2015 14:06
Show Gist options
  • Save lucacervasio/a3630d8fa573eb62b58c to your computer and use it in GitHub Desktop.
Save lucacervasio/a3630d8fa573eb62b58c to your computer and use it in GitHub Desktop.
package main
import (
"encoding/json"
"fmt"
)
func main() {
b := []byte(`{
"k1" : "v1",
"k3" : 10,
"result":["v4",12.3,{"k11" : "v11", "k22" : "v22"}]
}`)
var f interface{}
err := json.Unmarshal(b, &f)
if err != nil {
fmt.Println(err)
}
m := f.(map[string]interface{})
fmt.Println(m["k1"])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment