title: What's the golang equivalent of converting any JSON to standard dict in Python?
body: <p>In Python you can do something like this:</p>
  
  <pre><code>r = requests.get("http://wikidata.org/w/api.php", params=params)
  data = r.json()
  </code></pre>
  
  <p>And now <code>data</code> is a dict or hash table (also, I did not need to define beforehand the structure of the dict), and I can access values of keys by doing data["entities"], data["entities"]["Q12"], etc.</p>
  
  <p>How would I do this in golang? So far I have this:</p>
  
  <pre><code>resp, err := http.Get("http://wikidata.org/w/api.php?"+v.Encode())
  if err != nil {
      // handle error
  }
  
  defer resp.Body.Close()
  decoder := json.NewDecoder(resp.Body)
  var data interface{}
  decodeErr := decoder.Decode(&amp;data)
  if decodeErr != nil {
      // handle error
  }
  fmt.Println(data["entities"], data["entities"]["Q"+id])
  </code></pre>
  
  <p>Which gives me the compile error: <code>invalid operation: data["entities"] (index of type interface {})</code></p>
  
  <p>So what type should <code>var data</code> be? And do I need to define a structure to the JSON beforehand or is it possible to handle any JSON file/stream without modifying the code?</p>