PHP code example of majorgrey / pretty_json

1. Go to this page and download the library: Download majorgrey/pretty_json library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

majorgrey / pretty_json example snippets




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;