PHP 5.4 offers the JSON_PRETTY_PRINT
option for use with the json_encode()
call.
http://php.net/manual/en/function.json-encode.php
<?php
...
$json_string = json_encode($data, JSON_PRETTY_PRINT);
More Related Contents:
- How to remove array index from json object while convert array to jsonobject php? [closed]
- How can I parse data from server using Json?
- how to read Json values [closed]
- How do I generate a JSON file from PHP array? [duplicate]
- How to Convert string response to array laravel
- json_encode is returning NULL?
- Returning JSON from PHP to JavaScript?
- file_get_contents(“php://input”) or $HTTP_RAW_POST_DATA, which one is better to get the body of JSON request?
- PHP MySQL Google Chart JSON – Complete Example [closed]
- Facebook Graph API, how to get users email?
- Parsing JSON object in PHP using json_decode
- php: loop through json array
- Merging two json in PHP
- Converting MySQL result array to JSON [duplicate]
- PHP Fatal error: Call to undefined function json_decode()
- Serializing PHP object to JSON
- PHP7.1 json_encode() Float Issue
- PHP json encode – Malformed UTF-8 characters, possibly incorrectly encoded [duplicate]
- PHP Create a Multidimensional Array from an array with relational data [duplicate]
- json_decode to custom class
- How can I parse JSON into a html table using PHP?
- Removing array index reference when using json_encode()
- json decode in php
- Escaping/encoding single quotes in JSON encoded HTML5 data attributes
- How to insert json array into mysql database
- How to decode a JSON String with several objects in PHP?
- Access object property with disallowed character in property name
- Error “Cannot use object of type stdClass as array”
- Send JSON POST request with PHP
- How to keep json_encode() from dropping strings with invalid characters