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