How to Pretty Print Json In the Browser Dev Tools Console

preview_player
Показать описание
Two simple ways to pretty print JSON, in the browser without any additional tools needed.

- paste the JSON into the console and interact with it
- assign it to a variable and use the JSON.stringify() method

e.g.

~~~~~~~~
JSON.stringify(bob, null, 4)
~~~~~~~~

Quick Tip.

- if the json is in the response of a message then you can use the preview pane to see a formatted version - try the console methods when the json, is from code or in the page itself, or from another tool.

---

Hire me for consultancy and buy my online books and training at:

Рекомендации по теме
Комментарии
Автор

Thanks for the video. Didn't think about these ways of doing that. I usually use Preview tab to see structured json response (00:05 - tab to the left from response tab). It's the simplest way for me.

antonyamshchykou
Автор

Knew the second one. But always nice to see your videos Alan

ResterTest