Faraz Patankar
October 17, 2021
Updated on September 24, 2022
Pretty print JSON
A small snippet to pretty print JSON in the UI of your web application.
article cover

Sometimes, I just don't want to open the browser console to view the object that an API has returned. Maybe I am feeling lazy, maybe I have too many things open/logging in the console, whatever the reason, this tiny snippet helps me quickly print whatever it is in the UI.

{JSON.stringify(object, null, 2)}