pretty-print JSON using JavaScript

后端 未结 24 2168
一向
一向 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 06:55

    Douglas Crockford's JSON in JavaScript library will pretty print JSON via the stringify method.

    You may also find the answers to this older question useful: How can I pretty-print JSON in (unix) shell script?

提交回复
热议问题