[JS] Json 형태인 Object 출력하는법

2020. 4. 22. 13:45
반응형

[JS] Json 형태인 Object 출력하는법



json 형태를 가진 변수 TestAA의 데이터를 보고싶은 경우가 있다.

이것을 JS에서 다음과 같이 

1
2
alert(TestAA);
console.log(TestAA);
cs

alert, console.log 를 통해 안의 내용을 보고싶어하는데

정작 내용은 [object Object] 라고 나온다.

이방법을 해결하려면

다음과같이 JSON.stringify를 이용하여아한다

1
2
alert(JSON.stringify(TestAA));
console.log(JSON.stringify(TestAA));
cs



반응형

BELATED ARTICLES

more