title: Using Golang json.NewDecoder / json.NewEncoder
body: <p>I'm a total noob at go and I'm trying to understand what I'm missing here.  I'm expecting to use <code>dec.Decode</code> to loop over the json values and end up with a map of the response.  What I'm getting is the entire json string as the key to the first element of the map.  What am I missing?</p>
  
  <p>Example response:</p>
  
  <p><code>2015/03/02 10:03:16 map[error:invalid_request error_description:that is not a recognized WePay API call error_code:1001] map[string]interface {}</code></p>
  
  <pre><code>package main
  
  import (
      "encoding/json"
      "io"
      "log"
      "net/http"
      "reflect"
  )
  
  func main() {
      var v map[string]interface{}
      resp, err := http.Get("https://wepayapi.com/v2/")
      if err != nil {
          log.Println("Error: " + err.Error())
      }   
      defer resp.Body.Close()
  
      // resp.Body is an io.ReadCloser... NewDecoder expects an io.Reader
      dec := json.NewDecoder(resp.Body)
  
      // Decode reads the next JSON-encoded value from its input and stores it in the value pointed to by v.
      for err := dec.Decode(&amp;v); err != nil &amp;&amp; err != io.EOF; {
          log.Println("ERROR: " + err.Error())
          return
      }   
      log.Println(v, reflect.TypeOf(v))
  }
  </code></pre>