PHP Classes
elePHPant
Icontem

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   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2019-07-31 (17 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 12 This week: 2All time: 9,662 This week: 153Up
Version License PHP version Categories
json_formatter 1.0BSD License5HTML, PHP 5, Data types
Description Author

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
Nominee
Vote
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
  Performance   Level  
Name: chrys ugwu <contact>
Classes: 5 packages by
Country: Nigeria Nigeria
Age: 26
All time rank: 257111 in Nigeria Nigeria
Week rank: 25 Up1 in Nigeria Nigeria Up
Innovation award
Innovation award
Nominee: 3x

 

Details

JSON_Formatter

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

Latest Stable Version License Latest Stable Version Minimum PHP Version

Installation

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`

Usage:

<?php

$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);

Outputs:

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 README.md 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  
 100%
Total:12
This week:2
All time:9,662
This week:153Up