Skip to content

Instantly share code, notes, and snippets.

@anytizer
Created November 1, 2013 12:40
Show Gist options
  • Save anytizer/7264853 to your computer and use it in GitHub Desktop.
Save anytizer/7264853 to your computer and use it in GitHub Desktop.
json pretty print
/**
* 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