title: pointers in golang json unmarshalling
body: <p>I'm trying to unmarshal a web service response using the below command and it works fine.</p>
  
  <pre><code>bodyBytes, _ := ioutil.ReadAll(response.Body)
  bodyString := string(bodyBytes)
  err = json.Unmarshal([]byte(bodyString), &amp;output)
  fmt.Println(&amp;output)
  </code></pre>
  
  <p>When I use the pointer variable '&amp;output' it works fine ie; the outputs are displayed properly.</p>
  
  <p>but when I try to use the variable directly without &amp;(ampersand), the outputs do not look good.</p>
  
  <pre><code>bodyBytes, _ := ioutil.ReadAll(response.Body)
  bodyString := string(bodyBytes)
  err = json.Unmarshal([]byte(bodyString), output)
  fmt.Println(output)
  </code></pre>
  
  <p>What is the difference between these 2 variable - pointer vs normal variable while unmarshalling?</p>
  
  <pre><code>var output core.ApiData
  </code></pre>
  
  <p>The output is a type struct to match the apidata output.</p>