title: Convert HTTP JSON body response to map in Go
body: <p>I am trying to convert HTTP JSON body response to <code>map[string]interface{}</code> in Go.</p>
  
  <p>This is the code I wrote: </p>
  
  <pre><code>func fromHTTPResponse(httpResponse *http.Response, errMsg string )(APIResponse, error){
      temp, _ := strconv.Atoi(httpResponse.Status)
  
      var data map[string]interface{}
      resp, errResp := json.Marshal(httpResponse.Body)
      defer httpResponse.Body.Close()
      if errResp != nil {
          return APIResponse{}, errResp
      }
  
      err := json.Unmarshal(resp, &amp;data)
      if err != nil {
          return APIResponse{}, err
      }
  
      return APIResponse{httpResponse.Status, data, (temp == OK_RESPONE_CODE), errMsg, map[string]interface{}{} }, nil
  }
  </code></pre>
  
  <p>I successfully connect to the server. The response's body contains JSON data. After running the code, data points to <code>nil</code>, why is that?</p>