I came up with this little trick to format JSON output for a little test tool I was making:
echo json_encode(json_decode($json_string), JSON_PRETTY_PRINT);
It seems a bit silly: converting to an array so that I can then apply the pretty-print parameter to json_encode(), but then it is likely more efficient than some user-defined function to figure out where to add newlines and tabs/spaces. I was just wondering if I was missing anything in the standard library somewhere that would get the same results from an unformatted JSON string -- or is this about as good as anything?