Created
November 1, 2013 12:40
-
-
Save anytizer/7264853 to your computer and use it in GitHub Desktop.
json pretty print
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* If JSON_PRETTY_PRINT was NOT defined on the server, set to to false (unactivated) | |
*/ | |
if(!defined('JSON_PRETTY_PRINT')) define('JSON_PRETTY_PRINT', false); | |
function json_encode_custom($array=array()) | |
{ | |
if(JSON_PRETTY_PRINT) | |
{ | |
return json_encode($array, JSON_PRETTY_PRINT); | |
} | |
else | |
{ | |
return json_encode($array); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment