PHP Classes

PHP Reduce JSON: Compress JSON data using the reduced JSON format

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 56%Total: 500 All time: 5,817 This week: 673Up
Version License PHP version Categories
rjson-php 0.1.1The PHP License5.3PHP 5, Text processing, Data types
Description 

Author

This class can compress and decompress JSON data using the reduced JSON format.

It can take a variable value and encode it in reduced JSON format by avoiding duplication of key names of object values inside an array.

The class can also do the opposite, decode a previously encoded value in reduced JSON format and restore the original variable value.

Innovation Award
PHP Programming Innovation award nominee
April 2013
Number 6
JSON is now a popular text format for interchanging typed data between applications.

The reduced JSON format is an evolution of JSON that can take less space by avoiding certain types of data redundancies.

This class can encode and decode data structures exported in the reduced JSON format.

Manuel Lemos
Picture of Dmitri Russu
Name: Dmitri Russu <contact>
Classes: 2 packages by
Country: Moldova Moldova
Age: 36
All time rank: 18153 in Moldova Moldova
Week rank: 256 Up1 in Moldova Moldova Up
Innovation award
Innovation award
Nominee: 2x

Details

PHP5 RJson Version 0.1.1 === Copyright (c) 2013, Dmitri Russu <dmitri.russu@gmail.com> RJson return compact recursive data Array or Object Array by Algorithm Dmytro Dogadailo <entropyhacker@gmail.com>. === Compress Array data and Json data until 60%! === RJSON-php VS RJSON-js ========= How begin to use PHP RJSON example: $data = //Your recursive Array data; $pack = RJson::pack($data); $unpack = RJson::unpack($pack); How begin to use JavaScript RJSON example: data = //jason packedge from php; unpack = RJSON.unpack(data); packAndSendToSerevr = RJSON.pack(unpack); ... --------------------------------------------------------------------------------------- JavaScrip RJSON release https://github.com/dogada/RJSON from Dmytro Dogadailo. --------------------------------------------------------------------------------------- RJson converts any Array data collection into more compact recursive form. Compressed data is still JSON and can be parsed with `JSON.parse`. RJson can compress not only homogeneous collections, but any data sets with free structure. Below you can see initial form! Array: $data['data_process'] = array( 'template' => array('layers' => array( 'layer_id_one' => array('age' => 23,'name' => 'Robert', 'height' => 187), 'layer_id_two' => array('name' => 'Andre', 'age' => 24, 'height' => 188), ), 'themes_one' => array( 'theme_id_one' => array('name' => 'Green', 'width' => 11), 'theme_id_two' => array('name' => 'Yellow', 'width' => 12), ), 'themes_two' => array( 'theme_id_one' => array('name' => 'Green', 'width' => 11), 'theme_id_two' => array('name' => 'Yellow', 'width' => 12), ), 'designs' => array( array('title' => 'Design_1', 'width' => 23, 'height' => 187), array('width' => 24, 'title' => 'Design_2','height' => 181), ) ), 'id' => 7, 'tags' => array('php', 'javascript', 2013, null, false, true), 'users' => array( array('first' => 'Homer', 'last' => 'Simpson'), array('first' => 'Hank', 'last' => 'Hill'), ), 'library' => array( array('title' => 'RJSON-php', 'author' => 'Dmitri Russu', 'year' => 2013), array('title' => 'JavaScrip RJSON', 'author' => 'Dmytro Dogadailo', 'year' => 2012)) ); RJson result compact json or one compact php array(): RJson ENCODED Packedge {"id":7, "library": [{"author":"Dmitri Russu","title":"RJSON-php","year":2013}, [3,"Dmytro Dogadailo","JavaScrip RJSON",2012]], "tags": ["php","javascript",2013,null,false,true], "template":{ "designs": [{"height":187,"title":"Design_1","width":23}, [5,181,"Design_2",24]], "layers":{ "layer_id_one":{"age":23,"height":187,"name":"Robert"}, "layer_id_two":[7,24,188,"Andre"]}, "themes_one": {"theme_id_one":{"name":"Green","width":11}, "theme_id_two":[9,"Yellow",12]}, "themes_two": [8,[9,"Green",11], [9,"Yellow",12]]}, "users": [{"first":"Homer","last":"Simpson"}, [10,"Hank","Hill"]]} EXAMPLE OF USE RJson: You make a call class with one simple single tone request $data = array( 'projects' => Db_Model_Projects::findAllProjects($returnArrayRows), 'settings' => Db_Model_Settings::findAllSettings($returnArrayRows), 'pages' => Db_Model_Pages::findAllPages($returnArrayRows) ); $compactArrayPackedge = RJson::pack($data); $compactJsonFormatPackedge = RJson::pack($data, $json = true); $compactJsonFormatPackedge - this packedge you can send to Ajax request Where can make unpack with Js library * * <scrip language="JavaScript" type="text/javascript" > $.ajax( { "dataType": 'json', "type": "POST", "url": 'index.php?action=getData', "success": function(data) { packedge = RJSON.unpack(data); console.dir(packedge); } }); //Send packedge to server packedge = RJSON.pack(data); $.ajax( { "dataType": 'json', "type": "POST", "data": data, "url": 'index.php?action=saveData', "success": function(result) { console.log(result); } }); <script> RJson is a good practice to use on your Applications which make requests at server for obtains a big data to client Application.

  Files folder image Files (9)  
File Role Description
Files folder imagetest (5 files)
Accessible without login Plain text file LICENSE Lic. application license
Accessible without login Plain text file README.md Data Auxiliary data
Accessible without login Plain text file rjson.js Data Auxiliary data
Accessible without login Plain text file rjson.lib.php Class RJson-php,make compact data Array which can send to client with ajax request

  Files folder image Files (9)  /  test  
File Role Description
  Accessible without login Plain text file DataProcess.php Aux. Auxiliary script
  Accessible without login Plain text file final_array_unpacked.txt Doc. Documentation
  Accessible without login Plain text file index.php Aux. Auxiliary script
  Accessible without login Plain text file init_array.txt Doc. Documentation
  Accessible without login Plain text file jquery.js Data Auxiliary data

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 88%
Total:500
This week:0
All time:5,817
This week:673Up
User Ratings User Comments (1)
 All time
Utility:81%StarStarStarStarStar
Consistency:81%StarStarStarStarStar
Documentation:81%StarStarStarStarStar
Examples:-
Tests:-
Videos:-
Overall:56%StarStarStar
Rank:1755
 
Good Class !!!!!
11 years ago (alex stoica)
70%StarStarStarStar