Use native json pretty printing if available

`JSON_PRETTY_PRINT` constant has been available since PHP5.4, so let's use it.
Is the `&& JSON_PRETTY_PRINT` part necessary? I think `defined()` already covers the existence check. It is also possible (though unlikely) that in a future PHP version the value of the constant could be something falsy like `0`, which would make the condition fail.