Use JSON_PRETTY_PRINT available in php 5.4.