Compressing JSON with HPack algorithm

Hi friends,
Today I going to discuss about compressing  JSON data HPack Algorithm.
JSON.hpack is a lossless, cross language, performances focused, data set compressor. It is able to reduce up to 70% number of characters used to represent a generic homogeneous collection. This algorithms provides several level of compression (from 0 to 4). The level 0 compression performs the most basic compression by removing keys (property names) from the structure creating a header on index 0 with each property name. Next levels make it possible to reduce even more the size of the JSON by assuming that there are duplicated entries.
For the following JSON
[ { “name”:”Andrea”, “age”:31, “gender”:”Male”, “skilled”:true }, { “name”:”Eva”, “age”:27, “gender”:”Female”, “skilled”:true }, { “name”:”Daniele”, “age”:26, “gender”:”Male”, “skilled”:false } ]
the hpack algorithm produces a compressed version which looks like this:
[[“name”,”age”,”gender”,”skilled”],[“Andrea”,31,”Male”,true],[“Eva”,27,”Female”,true],[“Daniele”,26,”Male”,false]]
About JSON.hpack for PHP
Rather than a class or a public object, the PHP version respects its language nature, adding 4 functions in the global scope:
json_hpack, json_hunpack, json_hbest, and a “private use only” json_hunpack_createRow.
Please note that current PHP version works only with database fetched objects, rather than associative arrays.
For More detail please use https://github.com/WebReflection/json.hpack/wiki .
Cheers 🙂

Share This Post

Recent Articles

Leave a Reply

ERROR: si-captcha.php plugin: GD image support not detected in PHP!

Contact your web host and ask them to enable GD image support for PHP.

ERROR: si-captcha.php plugin: imagepng function not detected in PHP!

Contact your web host and ask them to enable imagepng for PHP.

© 2017 Networkocean. All rights reserved. Site Admin · Entries RSS · Comments RSS
Powered by WordPress · Designed by Theme Junkie