title: How to parse http response body to json format in golang?
body: <p>I get an response body. the format of the body is as below:</p>
  <pre><code>  [
      {
         &quot;id&quot;:1,
         &quot;name&quot;:&quot;111&quot; 
      },
      {
         &quot;id&quot;:2,
         &quot;name&quot;:&quot;222&quot; 
      }
    ]
  </code></pre>
  <p>I want to parse the body to json struct, my code is as below:</p>
  <pre><code>type Info struct {
        Id uint32 `json:id`
        Name string `json:name`
    }
  
    type Response struct {
        infos []Info
    }
  
    v := &amp;Response{}
    data, err := ioutil.ReadAll(response.Body)
    if err := json.Unmarshal(data, v); err != nil {
        log.Fatalf(&quot;Parse response failed, reason: %v \n&quot;, err)
    }
  </code></pre>
  <p>It always give an error:cannot unmarshal array into Go value of type xxx, can someone give a help?</p>