)
}
}
)
(
}
{
)
)
(
)
(
(
{
}
)
(
)
}
)
)
{
(
(
)
)
}
)
(
}

Pretty Print JSON in Console

  1.   const obj = {
  2.     x: 1, y: 2,
  3.     data: { test: 'xyz' }
  4.   };
  5.   console.log(JSON.stringify(obj, null, 2));

JSON.stringify has two more arguments that allow for pretty printing and processing of the object in question. The second argument is a “replacer” function and the third argument is for indentation. Read more details here.

I am pretty sure I first learned this from this stack overflow post.

I used this technique in yesterdays console hijacking post.

snippet.zone ~ 2021-24 /// {s/z}