기록이 힘이다.

Vue JS returning [Object object] on console.log and Undefined on JSON.parse / agGrid param [Object object] 본문

Vue

Vue JS returning [Object object] on console.log and Undefined on JSON.parse / agGrid param [Object object]

dev22 2024. 2. 28. 12:50
728x90

javascript - Vue JS returning [Object object] on console.log and Undefined on JSON.parse - Stack Overflow

 

Vue JS returning [Object object] on console.log and Undefined on JSON.parse

So I am writing this Vue.JS code to display a data aquired by PHP from a server. The PHP returns a JSON object to the Vue and the VUE has to display it. My current code is: axiosPost(); } function

stackoverflow.com

 

이번 프로젝트에서는 agGrid를 사용한 Vue.js 를 하고 있다. 

grid column에서 params로 리턴을 받아 값을 찍어보려고 하는데 console에 [Object object]로 찍혀 반환받고 싶은 값을 제대로 확인 할 수 없었고 파싱하고 여러 방법을 사용해도 값을 확인하기 힘들었다. 

 

콘솔을 찍을때 +를 사용하여 console.log("값 확인"+ 변수)를 사용하였는데 이 같은 방법을 사용할 경우 문자열 결합으로 강제 형변환이 되어 [Object object]로 인지하게 된다. 그래서 console.log("값 확인", 변수)로 사용하여 제대로된 값을 확인할 수 있음을 깨달았다.