pretty-print JSON using JavaScript

后端 未结 24 1713
一向
一向 2020-11-21 06:45

How can I display JSON in an easy-to-read (for human readers) format? I\'m looking primarily for indentation and whitespace, with perhaps even colors / font-styles / etc.

24条回答
  •  醉酒成梦
    2020-11-21 07:05

    For debugging purpose I use:

    console.debug("%o", data);
    
    • https://getfirebug.com/wiki/index.php/Console_API
    • https://developer.mozilla.org/en-US/docs/DOM/console

提交回复
热议问题