logo small

How to Implement PHP json_decode Function in Pure PHP to Be Able to Decode Large JSON Data Heavy JSON Decode: Parse and decode JSON data from a file or string

Recommend this page to a friend!
Download Download
Info Example View files Files Install with Composer Install with Composer Download Download Reputation Support forum Blog Links
Last Updated Ratings Unique User Downloads Download Rankings
2025年10月07日 (4 hours ago) RSS 2.0 feed Not enough user ratings Total: 21 All time: 11,324 This week: 40Up
Version License PHP version Categories
heavyjsondecode 1.0 MIT/X Consortium ... 5 PHP 5 , Data types , Parsers

This class can parse and decode JSON data from a file or string.

It can take a file name or a string as a parameter to specify the data source to read the JSON data.

The class can read and parse the JSON data and returns an array of JSON elements.

Picture of Ramesh Narayan Jangid (Sharma)
Performance Level
Name: Ramesh Narayan Jangid ... <contact>
Classes: 11 packages by
Country: India India
Age: 49
All time rank: 3033190 in India India
Week rank: 195 Up19 in India India Up
Innovation award
Innovation award
Nominee: 5x

Winner: 4x

Example

JSON Decode

PHP JSON Decode large data with lesser resources

Examples

Validating JSON.

<?php
require_once __DIR__ . '/AutoloadJsonDecode.php';
use CustomJsonDecode\JsonDecoder;
// Creating json file handle
$fp = fopen('/usr/local/var/www/rnd/test.json', 'rb');
// Create JsonDecode Object.
JsonDecoder::init($fp);
$jsonDecodeObj = JsonDecoder::getObject();
// Validate JSON
$jsonDecodeObj->validate();
$jsonDecodeObj = null;

Accessing data of Array after indexing JSON.

<?php
require_once __DIR__ . '/AutoloadJsonDecode.php';
use CustomJsonDecode\JsonDecoder;
// Creating json file handle
$fp = fopen('/usr/local/var/www/rnd/test.json', 'rb');
// Create JsonDecode Object.
JsonDecoder::init($fp);
$jsonDecodeObj = JsonDecoder::getObject();
// Indexing JSON
$jsonDecodeObj->indexJson();
// Transverse across key 'data'
if (
 $jsonDecodeObj->isset('data') && $jsonDecodeObj->jsonType('data') === 'Array'
) {
 for ($i = 0, $i_count = $jsonDecodeObj->count('data'); $i < $i_count; $i++) {
 $key = "data:{$i}";
 // Row details without Sub arrays
 $row = $jsonDecodeObj->get($key);
 print_r($row);
 // Row with Sub arrays / Complete $key array recursively.
 $completeRow = $jsonDecodeObj->getCompleteArray($key);
 print_r($completeRow);
 }
}
$jsonDecodeObj = null;

Files folder image Files (8)
File Role Description
Files folder imageCustomJsonDecode (4 files)
Plain text file Autoload.php Class Class source
Accessible without login Plain text file AutoloadJsonDecode.php Aux. Configuration script
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Example Example script

Files folder image Files (8) / CustomJsonDecode
File Role Description
Plain text file JsonDecode.php Class Class source
Plain text file JsonDecodeEngine.php Class Class source
Plain text file JsonDecodeObject.php Class Class source
Plain text file JsonDecoder.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Version Control Unique User Downloads Download Rankings
100%
Total: 21
This week: 0
All time: 11,324
This week: 40 Up
About us About us Advertise on this site Advertise on this site Site map Site map Newsletter Newsletter Statistics Statistics Site tips Site tips Privacy policy Privacy policy Contact Contact

AltStyle によって変換されたページ (->オリジナル) /