PHP Classes

PHP JSON Pretty Print: Display data types like human-readable JSON values

Recommend this page to a friend!
  Info   View files Example   View files View files (6)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 140 All time: 9,170 This week: 161Up
Version License PHP version Categories
json_formatter 1.0.0BSD License5HTML, PHP 5, Data types


Chrys Ugwu


This class can display data types like human-readable JSON values.

It takes the a variable value as parameter and encodes it as JSON object.

The class processes the JSON output and reformats it to display nicely in a HTML Web page.

Innovation Award
PHP Programming Innovation award nominee
July 2019
Number 10
Many developers need to check values used in their applications variables. One easy way of seeing those values is to display them on a Web page.

Nowadays, many developers prefer to use the JSON format to display application variable values. PHP supports the JSON format but sometimes the output of the JSON encoding functions is not very readable.

This class provides a solution to display application variable values using the JSON format in a way that can be more readable for all developers.

Manuel Lemos
Picture of chrys ugwu
  Performance   Level  
Name: chrys ugwu <contact>
Classes: 16 packages by
Country: Nigeria Nigeria
Age: 30
All time rank: 17007 in Nigeria Nigeria
Week rank: 58 Up5 in Nigeria Nigeria Up
Innovation award
Innovation award
Nominee: 4x



Allows you to pretty-print JSON data in a human-readable format

Latest Stable Version License Latest Stable Version Minimum PHP Version


You can download the Latest release version as a standalone, alternatively you can use Composer for optional dependencies such as PHPUnit.

$ composer require ghostff/json-formatter

Or add:

    "require": {
        "ghostff/json-formatter": "^1.0"

to your `composer.json`



$source = array (
  array ( 'points' => 1, 'name' => 'Peter'),
  array ( 'points' => 5, 'name' => 'Mike'),
  array ( 'points' => 2, 'name' => 'John Zoo'),
  array ( 'points' => 2, 'name' => 'John Ab')

echo Json::encode($source);


alt tag

  Files folder image Files  
File Role Description
Files folder imagesrc (1 file)
Plain text file composer.json Data Auxiliary data
Plain text file index.php Example Example
Plain text file Doc. Documentation
Image file SS.png Data Auxiliary data
Plain text file text.php Aux. Auxiliary script

  Files folder image Files  /  src  
File Role Description
  Plain text file Json.php Class Class source

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:9,170
This week:161Up