If your on php 4.5 or above you can use the JSON_PRETTY_PRINT.
$json_string = json_encode($data, JSON_PRETTY_PRINT);
More Related Contents:
- How to create this type of JSON data from PHP [closed]
- How can I parse a JSON file with PHP? [duplicate]
- How to POST JSON Data With PHP cURL?
- Cannot use object of type stdClass as array?
- Issue reading HTTP request body from a JSON POST in PHP [duplicate]
- PHP json_encode encoding numbers as strings
- Why is json_encode adding backslashes?
- The holy grail of cleaning input and output in php?
- php json_encode not working on arrays partially
- Any way to return PHP `json_encode` with encode UTF-8 and not Unicode? [duplicate]
- php get values from json encode
- Why is this PHP call to json_encode silently failing – inability to handle single quotes?
- json_decode returns JSON_ERROR_SYNTAX but online formatter says the JSON is OK
- Best way to create an empty object in JSON with PHP?
- How to update/edit a JSON file using PHP [closed]
- PHP’s json_encode does not escape all JSON control characters
- POST request with JSON body
- Handling big user IDs returned by FQL in PHP
- org.json.JSONException: Value
- Parse JSON string contents into PHP Array
- Invalid JSON parsing using PHP
- PHP convert XML to JSON group when there is one child
- How to build a JSON array from mysql database
- Handling data in a PHP JSON Object
- Get value from JSON array in PHP
- json parse error with double quotes
- how to fetch all the row of the result in php mysql?
- How to decode a JSON String with several objects in PHP?
- Access object property with disallowed character in property name
- How to keep json_encode() from dropping strings with invalid characters