类型接口{}不支持索引

I want to get values from bid. I've already tried data.(map[string]interface{}) but It did not work.

when I tried, It says:

"interface conversion: interface {} is []interface {}, not map[string]interface {}"

Please help me...

This is my code.

    url := "https://api.binance.com/api/v1/depth?symbol=RENBTC"
    a, _ := http.Get(url)
    e, _ := ioutil.ReadAll(a.Body)

    var data map[string]interface{}

    _ = json.Unmarshal([]byte(e), &data)
    bid := data["bids"]
    fmt.Println(bid[0])

tooltip

You need type assertion bid, ok := data["bids"].([]interface{})
See: Explain Type Assertions in Go

Try this:

package main

import (
    "encoding/json"
    "fmt"
    "io/ioutil"
    "log"
    "net/http"
)

func main() {
    url := "https://api.binance.com/api/v1/depth?symbol=RENBTC"
    a, err := http.Get(url)
    if err != nil {
        log.Fatal(err)
    }

    buf, err := ioutil.ReadAll(a.Body)
    if err != nil {
        log.Fatal(err)
    }

    var data map[string]interface{}
    err = json.Unmarshal([]byte(buf), &data)
    if err != nil {
        log.Fatal(err)
    }

    bid, ok := data["bids"].([]interface{})
    if !ok {
        log.Fatal("not ok")
    }

    s, ok := bid[0].([]interface{})
    if !ok {
        log.Fatal("not ok")
    }
    fmt.Println(s)
}

Output:

[0.00000603 5122.00000000]