JSON_PRETTY_PRINT
was introduced in PHP 5.4.0.
If you would like to make your code more readable in earlier versions of PHP, use these constants instead of their numerical values. Notice that I put the version each became available--if you use an option in an earlier version of PHP, don't expect it to work.
<?php
// json_encode() options
define('JSON_HEX_TAG', 1); // Since PHP 5.3.0
define('JSON_HEX_AMP', 2); // Since PHP 5.3.0
define('JSON_HEX_APOS', 4); // Since PHP 5.3.0
define('JSON_HEX_QUOT', 8); // Since PHP 5.3.0
define('JSON_FORCE_OBJECT', 16); // Since PHP 5.3.0
define('JSON_NUMERIC_CHECK', 32); // Since PHP 5.3.3
define('JSON_UNESCAPED_SLASHES', 64); // Since PHP 5.4.0
define('JSON_PRETTY_PRINT', 128); // Since PHP 5.4.0
define('JSON_UNESCAPED_UNICODE', 256); // Since PHP 5.4.0
// json_decode() options
define('JSON_OBJECT_AS_ARRAY', 1); // Since PHP 5.4.0
define('JSON_BIGINT_AS_STRING', 2); // Since PHP 5.4.0
define('JSON_PARSE_JAVASCRIPT', 4); // upgrade.php
// json_last_error() error codes
define('JSON_ERROR_NONE', 0); // Since PHP 5.3.0
define('JSON_ERROR_DEPTH', 1); // Since PHP 5.3.0
define('JSON_ERROR_STATE_MISMATCH', 2); // Since PHP 5.3.0
define('JSON_ERROR_CTRL_CHAR', 3); // Since PHP 5.3.0
define('JSON_ERROR_SYNTAX', 4); // Since PHP 5.3.0
define('JSON_ERROR_UTF8', 5); // Since PHP 5.3.3
define('JSON_ERROR_RECURSION', 6); // Since PHP 5.5.0
define('JSON_ERROR_INF_OR_NAN', 7); // Since PHP 5.5.0
define('JSON_ERROR_UNSUPPORTED_TYPE', 8); // Since PHP 5.5.0
?>
JSON_PRETTY_PRINT
. (you might want to enable notices, it will tell you it doesn't know the constant) – Wrikken Mar 5 '14 at 20:48