Pretty-Printing JSON with PHP
PHP 5.4 offers the JSON_PRETTY_PRINT option for use with the json_encode() call. http://php.net/manual/en/function.json-encode.php
PHP 5.4 offers the JSON_PRETTY_PRINT option for use with the json_encode() call. http://php.net/manual/en/function.json-encode.php
Pretty-printing is implemented natively in JSON.stringify(). The third argument enables pretty printing and sets the spacing to use: If you need syntax highlighting, you might use some regex magic like so: See in action here: jsfiddle Or a full snippet provided below: Show code snippet