Json pretty print support for PHP versions older than 5.4.

Since i'm not using PHP 5.4 for the moment, i added support for json pretty print for older versions.
I tried to follow the style of the other pull requests. Hope's ok.