본문 바로가기
Programing Language/Javascript

[Javascript] console.log() JSON pretty print

by pcm9881 2023. 6. 12.
const obj = { "name" : "홍길동", "age": 30, "hobby": "등산" };
console.log(JSON.stringify(obj, null, 2));

결과

{
  "name": "홍길동",
  "age": 30,
  "hobby": "등산"
}
728x90

댓글