Replacement for PHP's json_encode() that produces nicely formatted JSON output.