Question: Firestore returns `map[string]interface{}` while getting data. How can I render "details" values?

```
user:{
      fname:"john",
      lname:"con",
      detail:{
             address:"Delhi, India",
             mob:"0000000009"
             }
}

```

```
sn := snap.Data()
    var bt []byte

    for _, val := range sn {
        for _, v := range val {
            log.Println("value ", v)
        }
    }

```

Answer: 
Use [json.Unmarshal](https://golang.org/pkg/encoding/json/#Unmarshal) to convert your JSON content to a map.

```
    jsonString := `{"user":true,"lname":"con","detail":{"address":"Delhi, India","mob":"0000000009"}}`
    aMap := make(map[string]interface{})
    err := json.Unmarshal([]byte(jsonString), &aMap)
    if err != nil {
        fmt.Println("error:", err)
    }
    fmt.Printf("%+v\n", aMap)
    fmt.Printf("Address := %s\n",aMap["detail"].(map[string]interface{})["address"])

```

<https://play.golang.org/p/3133C_sKDf4>
First things first. Your JSON appears to be invalid. It looks like a few
quotes are missing.

Try to validate your sample data [here](https://jsonlint.com/) and you'll see what's wrong with it.

Alternatively to decode your JSON to a map, you can also unmarshal it into a struct as long as you know its structure in advance.

```
type User struct {
    FirstName string `json:"fname"`
    LastName  string `json:"lname"`
    Detail    Detail `json:"detail"`
}

type Detail struct {
    Address string `json:"address"`
    Mobile  string `json:"mob"`
}

if err := json.NewDecoder(strings.NewReader(out)).Decode(&u); err != nil {
    log.Fatal(err)
}

```

[Full working example](https://play.golang.org/p/ltRM7v9vGN5)