PHP JSON Print Print
$json_string = json_encode($data, JSON_PRETTY_PRINT);
TheGuy920
$json_string = json_encode($data, JSON_PRETTY_PRINT);
header('Content-Type: application/json');
JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES
composer require majorgrey/pretty_json
<?php
use MajorGrey\PrettyJson;
$array = array(
"name" => "majorgrey",
'email' => "[email protected]",
'metadata' => array (
'color' => 'blue',
'food' => 'chicken'
)
);
$json = json_encode($array);
$pretty_json = PrettyJson::print($json);
echo $pretty_json;
composer require majorgrey/pretty_json