Tidy JSON for PHP

I wrote a simple PHP utility that will convert ugly, convoluted JSON into a nicer, standard format. It doesn’t perform any validation and is not optimized whatsoever – but maybe it’s just what you’re looking for. You can find it over on github: Tidy JSON.



require 'tidyjson.php';

$json = '{"foo":"bar","baz":[1,2,5]}';
$tidy = TidyJSON::tidy($json);

  • Manuel Gomes

    Good stuff, Mike – definitely easier on my eyes since I hacked it into my workflow

  • Alex

    like it!!!! thanks!