Created
August 30, 2012 16:15
-
-
Save cam-gists/3532096 to your computer and use it in GitHub Desktop.
PHP: Pretty Print JSON
This file contains hidden or 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
<?php | |
echo "<pre>"; | |
$pattern = array(',"', '{', '}'); | |
$replacement = array(",\n\t\"", "{\n\t", "\n}"); | |
echo str_replace($pattern, $replacement, $data); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment