PHP Classes
elePHPant
Icontem

PHP JSON Parser Class: Encode and decode data in JSON format

Recommend this page to a friend!
  Info   View files Example   View files View files (10)   DownloadInstall with Composer Download .zip   Reputation   Support forum (14)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2019-04-03 (1 month ago) RSS 2.0 feedStarStarStarStar 69%Total: 236 This week: 2All time: 7,838 This week: 184Up
Version Licenses PHP version Categories
jsonparser 2.2.1Custom (specified...5PHP 5, Data types, Parsers
Description Author

This package can encode and decode data in JSON format.

I provides a pure PHP solution to take a value and generates a string that represents that value in JSON format.

The package can also take a JSON encoded string and decodes it to retrieve the original data value.

Innovation Award
PHP Programming Innovation award nominee
February 2019
Number 3
PHP comes with built-in support to parse and encode data in the JSON format but it provides limited support to determine if a data JSON string value is well encoded.

This package implements a JSON parse in pure PHP in such a way that is possible to determine more details about errors of a JSON string that is malformed, thus helping developers to validate JSON strings and give the precise location of any errors.

Manuel Lemos
  Performance   Level  
Name: Max Base <contact>
Classes: 2 packages by
Country: United States United States
Age: ???
All time rank: 3698430 in United States United States
Week rank: 125 Up9 in United States United States Up
Innovation award
Innovation award
Nominee: 1x

Details

PHP JsonParser

Tiny Library for parse JSON.

JsonParser can encode and decode data in JSON format.

We provides a pure PHP solution to take a value and generates a string that represents that value in JSON format.

The package can also take a JSON encoded string and decodes it to retrieve the original data value.

JsonParser.php File Size JsonParser.min.php File Size JsonParser.php Validation Code

Features

  • Small and light library
  • Hand-coded scanner
  • Analyze and found Errors
  • Unicode Support
  • No dependencies (only suitable version of the PHP)
  • Written and run on PHP 7.2.6, PHP 7.3.4

Type of supported values

  • [x] Integer
  • [x] Float
  • [x] Boolean (true , false)
  • [x] Null
  • [x] String
  • [x] Char (Now this is same as a string)
  • [x] Sub Array
  • [x] Sub Object

TODO

  • Improve speed and performance (Speed does not reach C Language!)

Usage

All public functions are accessible through the $json variable.

  • array $json->decode(string);
  • string $json->encode(array);

Samples

To view the full details, run the Example.php file.

JSON Grammar

You can check the JSONGrammar.txt file to view the JSON standard grammar.

Performance

Competition between json_encode(...) and $json->encode(...)

The basic PHP functions are written in C itself.

Do not expect to reach it quickly.

However, there is always way for improvement.

History

  • Version 1.0 (first) : 2018-06-26 - 2018-06-26
  • Version 2.1 : 2018-06-27 - 2019-03-13
  • Version 2.2 : 2019-03-25
  • Version 2.2.1 : 2019-04-04

License

JsonParser is licensed under the GNU General Public License.

  Files folder image Files  
File Role Description
Accessible without login Plain text file Benchmark.md Data Auxiliary data
Accessible without login Plain text file composer.json Data This package has been released in Composer.
Accessible without login Plain text file Example.php Example Example script
Accessible without login Plain text file JSONGrammar.txt Doc. Documentation
Plain text file JsonParser-min.php Class The compressed file was added.
Plain text file JsonParser.php Class Class source
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file Performance-own.php Example Example script
Accessible without login Plain text file Performance-php.php Aux. Auxiliary script
Accessible without login Plain text file README.md Doc. Documentation

 Version Control Unique User Downloads Download Rankings  
 100%
Total:236
This week:2
All time:7,838
This week:184Up
User Ratings User Comments (13)
 All time
Utility:83%StarStarStarStarStar
Consistency:91%StarStarStarStarStar
Documentation:91%StarStarStarStarStar
Examples:91%StarStarStarStarStar
Tests:-
Videos:-
Overall:69%StarStarStarStar
Rank:483