├── .gitignore ├── versions ├── jsonc.min.js.gz └── jsonc.min.js ├── Benchmark ├── Benchmark_Results.png ├── obj │ ├── demo_pack_gzip_with_base64 │ │ ├── alo.php │ │ ├── css │ │ │ └── style.css │ │ ├── GzipJSON.php │ │ ├── js │ │ │ └── app.js │ │ └── data │ │ │ └── data2.js │ ├── demo_pack_gzip_compress_with_base64 │ │ ├── alo.php │ │ ├── css │ │ │ └── style.css │ │ ├── GzipJSON.php │ │ └── js │ │ │ └── app.js │ ├── demo_pack_gzip_without_base64 │ │ ├── alo.php │ │ ├── css │ │ │ └── style.css │ │ ├── GzipJSON.php │ │ └── js │ │ │ └── app.js │ ├── demo_pack_gzip_compress_without_base64 │ │ ├── alo.php │ │ ├── css │ │ │ └── style.css │ │ ├── GzipJSON.php │ │ └── js │ │ │ └── app.js │ ├── demo_simple_json_stringify │ │ ├── alo.php │ │ ├── css │ │ │ └── style.css │ │ ├── GzipJSON.php │ │ └── js │ │ │ └── app.js │ └── demo_simple_json_stringify_with_base64 │ │ ├── alo.php │ │ ├── css │ │ └── style.css │ │ ├── GzipJSON.php │ │ └── js │ │ └── app.js └── obj2 │ ├── demo_pack_gzip_with_base64 │ ├── alo.php │ ├── css │ │ └── style.css │ ├── GzipJSON.php │ └── js │ │ └── app.js │ ├── demo_pack_gzip_without_base64 │ ├── alo.php │ ├── css │ │ └── style.css │ ├── GzipJSON.php │ └── js │ │ └── app.js │ ├── demo_pack_gzip_compress_with_base64 │ ├── alo.php │ ├── css │ │ └── style.css │ ├── GzipJSON.php │ └── js │ │ └── app.js │ ├── demo_pack_gzip_compress_without_base64 │ ├── alo.php │ ├── css │ │ └── style.css │ ├── GzipJSON.php │ └── js │ │ └── app.js │ ├── demo_simple_json_stringify │ ├── alo.php │ ├── css │ │ └── style.css │ ├── GzipJSON.php │ └── js │ │ └── app.js │ └── demo_simple_json_stringify_with_base64 │ ├── alo.php │ ├── css │ └── style.css │ ├── GzipJSON.php │ └── js │ └── app.js ├── bower.json ├── .travis.yml ├── src ├── .jshintrc └── JSONC.js ├── php └── GzipJSON.php ├── changelog.txt ├── LICENSE ├── package.json ├── karma.conf.js ├── Gruntfile.js ├── vendor ├── crc32.js ├── base64.js ├── gzip.js └── rawinflate.js ├── README.md └── test └── JSONC.js /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/* 2 | .node_modules/* 3 | .coverage/* 4 | -------------------------------------------------------------------------------- /versions/jsonc.min.js.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tcorral/JSONC/HEAD/versions/jsonc.min.js.gz -------------------------------------------------------------------------------- /Benchmark/Benchmark_Results.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tcorral/JSONC/HEAD/Benchmark/Benchmark_Results.png -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jsoncomp", 3 | "version": "1.6.1", 4 | "repository": { 5 | "type": "git", 6 | "url": "git://github.com/tcorral/JSONC.git" 7 | } 8 | } -------------------------------------------------------------------------------- /Benchmark/obj/demo_pack_gzip_with_base64/alo.php: -------------------------------------------------------------------------------- 1 | decompress($_POST['json']); 8 | $json->test2 = 3; 9 | echo json_encode($json); 10 | } -------------------------------------------------------------------------------- /Benchmark/obj/demo_pack_gzip_compress_with_base64/alo.php: -------------------------------------------------------------------------------- 1 | decompress($_POST['json']); 8 | $json->test2 = 3; 9 | echo json_encode($json); 10 | } -------------------------------------------------------------------------------- /Benchmark/obj/demo_pack_gzip_without_base64/alo.php: -------------------------------------------------------------------------------- 1 | decompress($_POST['json']); 8 | $json->test2 = 3; 9 | echo json_encode($json); 10 | } -------------------------------------------------------------------------------- /Benchmark/obj2/demo_pack_gzip_with_base64/alo.php: -------------------------------------------------------------------------------- 1 | decompress($_POST['json']); 8 | $json->test2 = 3; 9 | echo json_encode($json); 10 | } -------------------------------------------------------------------------------- /Benchmark/obj2/demo_pack_gzip_without_base64/alo.php: -------------------------------------------------------------------------------- 1 | decompress($_POST['json']); 8 | $json->test2 = 3; 9 | echo json_encode($json); 10 | } -------------------------------------------------------------------------------- /Benchmark/obj2/demo_pack_gzip_compress_with_base64/alo.php: -------------------------------------------------------------------------------- 1 | decompress($_POST['json']); 8 | $json->test2 = 3; 9 | echo json_encode($json); 10 | } -------------------------------------------------------------------------------- /Benchmark/obj/demo_pack_gzip_compress_without_base64/alo.php: -------------------------------------------------------------------------------- 1 | decompress($_POST['json']); 8 | $json->test2 = 3; 9 | echo json_encode($json); 10 | } -------------------------------------------------------------------------------- /Benchmark/obj2/demo_pack_gzip_compress_without_base64/alo.php: -------------------------------------------------------------------------------- 1 | decompress($_POST['json']); 8 | $json->test2 = 3; 9 | echo json_encode($json); 10 | } -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "0.10" 4 | before_install: 5 | - sudo rm -rf /usr/local/phantomjs 6 | - curl -L -O https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-x86_64.tar.bz2 7 | - tar xjf phantomjs-1.9.7-linux-x86_64.tar.bz2 8 | - sudo mv phantomjs-1.9.7-linux-x86_64 /usr/local/phantomjs 9 | -------------------------------------------------------------------------------- /Benchmark/obj/demo_simple_json_stringify/alo.php: -------------------------------------------------------------------------------- 1 | decompress($_POST['json']);*/ 8 | $json = json_decode( $_POST['json'], true ); 9 | $json["test2"] = 3; 10 | echo json_encode($json); 11 | } -------------------------------------------------------------------------------- /Benchmark/obj2/demo_simple_json_stringify/alo.php: -------------------------------------------------------------------------------- 1 | decompress($_POST['json']);*/ 8 | $json = json_decode( $_POST['json'], true ); 9 | $json["test2"] = 3; 10 | echo json_encode($json); 11 | } -------------------------------------------------------------------------------- /Benchmark/obj/demo_simple_json_stringify_with_base64/alo.php: -------------------------------------------------------------------------------- 1 | decompress($_POST['json']);*/ 8 | $json = json_decode(base64_decode($_POST['json'])); 9 | $json->test2 = 3; 10 | echo json_encode($json); 11 | } -------------------------------------------------------------------------------- /Benchmark/obj2/demo_simple_json_stringify_with_base64/alo.php: -------------------------------------------------------------------------------- 1 | decompress($_POST['json']);*/ 8 | $json = json_decode(base64_decode($_POST['json'])); 9 | $json->test2 = 3; 10 | echo json_encode($json); 11 | } -------------------------------------------------------------------------------- /src/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "boss": true, 3 | "curly": true, 4 | "eqeqeq": true, 5 | "eqnull": true, 6 | "expr": true, 7 | "immed": true, 8 | "noarg": true, 9 | "onevar": true, 10 | "quotmark": "single", 11 | "smarttabs": true, 12 | "trailing": true, 13 | "undef": true, 14 | "unused": true, 15 | 16 | "sub": true, 17 | 18 | "browser": true, 19 | "es5": false, 20 | 21 | "globals": { 22 | "Hydra": true, 23 | "define": true, 24 | "module": true, 25 | "Event": true 26 | } 27 | } -------------------------------------------------------------------------------- /Benchmark/obj/demo_pack_gzip_with_base64/css/style.css: -------------------------------------------------------------------------------- 1 | #accordion_data div 2 | { 3 | max-height: 200px; 4 | } 5 | .size 6 | { 7 | font-family: monospace; 8 | font-size: 20px; 9 | font-weight: bold; 10 | } 11 | .code 12 | { 13 | font-family: monospace; 14 | font-size: 9px; 15 | } 16 | .fright 17 | { 18 | float: right; 19 | width: 300px; 20 | } 21 | #accordion_usage .ui-accordion-header 22 | { 23 | height: 50px; 24 | } 25 | input[type=button], input[type=submit] 26 | { 27 | font-size: 11px; 28 | } 29 | form div 30 | { 31 | font-size: 12px; 32 | } 33 | ul 34 | { 35 | list-style-type: none; 36 | margin: 0; 37 | padding: 0; 38 | } -------------------------------------------------------------------------------- /Benchmark/obj/demo_simple_json_stringify/css/style.css: -------------------------------------------------------------------------------- 1 | #accordion_data div 2 | { 3 | max-height: 200px; 4 | } 5 | .size 6 | { 7 | font-family: monospace; 8 | font-size: 20px; 9 | font-weight: bold; 10 | } 11 | .code 12 | { 13 | font-family: monospace; 14 | font-size: 9px; 15 | } 16 | .fright 17 | { 18 | float: right; 19 | width: 300px; 20 | } 21 | #accordion_usage .ui-accordion-header 22 | { 23 | height: 50px; 24 | } 25 | input[type=button], input[type=submit] 26 | { 27 | font-size: 11px; 28 | } 29 | form div 30 | { 31 | font-size: 12px; 32 | } 33 | ul 34 | { 35 | list-style-type: none; 36 | margin: 0; 37 | padding: 0; 38 | } -------------------------------------------------------------------------------- /Benchmark/obj2/demo_pack_gzip_with_base64/css/style.css: -------------------------------------------------------------------------------- 1 | #accordion_data div 2 | { 3 | max-height: 200px; 4 | } 5 | .size 6 | { 7 | font-family: monospace; 8 | font-size: 20px; 9 | font-weight: bold; 10 | } 11 | .code 12 | { 13 | font-family: monospace; 14 | font-size: 9px; 15 | } 16 | .fright 17 | { 18 | float: right; 19 | width: 300px; 20 | } 21 | #accordion_usage .ui-accordion-header 22 | { 23 | height: 50px; 24 | } 25 | input[type=button], input[type=submit] 26 | { 27 | font-size: 11px; 28 | } 29 | form div 30 | { 31 | font-size: 12px; 32 | } 33 | ul 34 | { 35 | list-style-type: none; 36 | margin: 0; 37 | padding: 0; 38 | } -------------------------------------------------------------------------------- /Benchmark/obj2/demo_simple_json_stringify/css/style.css: -------------------------------------------------------------------------------- 1 | #accordion_data div 2 | { 3 | max-height: 200px; 4 | } 5 | .size 6 | { 7 | font-family: monospace; 8 | font-size: 20px; 9 | font-weight: bold; 10 | } 11 | .code 12 | { 13 | font-family: monospace; 14 | font-size: 9px; 15 | } 16 | .fright 17 | { 18 | float: right; 19 | width: 300px; 20 | } 21 | #accordion_usage .ui-accordion-header 22 | { 23 | height: 50px; 24 | } 25 | input[type=button], input[type=submit] 26 | { 27 | font-size: 11px; 28 | } 29 | form div 30 | { 31 | font-size: 12px; 32 | } 33 | ul 34 | { 35 | list-style-type: none; 36 | margin: 0; 37 | padding: 0; 38 | } -------------------------------------------------------------------------------- /Benchmark/obj/demo_pack_gzip_without_base64/css/style.css: -------------------------------------------------------------------------------- 1 | #accordion_data div 2 | { 3 | max-height: 200px; 4 | } 5 | .size 6 | { 7 | font-family: monospace; 8 | font-size: 20px; 9 | font-weight: bold; 10 | } 11 | .code 12 | { 13 | font-family: monospace; 14 | font-size: 9px; 15 | } 16 | .fright 17 | { 18 | float: right; 19 | width: 300px; 20 | } 21 | #accordion_usage .ui-accordion-header 22 | { 23 | height: 50px; 24 | } 25 | input[type=button], input[type=submit] 26 | { 27 | font-size: 11px; 28 | } 29 | form div 30 | { 31 | font-size: 12px; 32 | } 33 | ul 34 | { 35 | list-style-type: none; 36 | margin: 0; 37 | padding: 0; 38 | } -------------------------------------------------------------------------------- /Benchmark/obj2/demo_pack_gzip_without_base64/css/style.css: -------------------------------------------------------------------------------- 1 | #accordion_data div 2 | { 3 | max-height: 200px; 4 | } 5 | .size 6 | { 7 | font-family: monospace; 8 | font-size: 20px; 9 | font-weight: bold; 10 | } 11 | .code 12 | { 13 | font-family: monospace; 14 | font-size: 9px; 15 | } 16 | .fright 17 | { 18 | float: right; 19 | width: 300px; 20 | } 21 | #accordion_usage .ui-accordion-header 22 | { 23 | height: 50px; 24 | } 25 | input[type=button], input[type=submit] 26 | { 27 | font-size: 11px; 28 | } 29 | form div 30 | { 31 | font-size: 12px; 32 | } 33 | ul 34 | { 35 | list-style-type: none; 36 | margin: 0; 37 | padding: 0; 38 | } -------------------------------------------------------------------------------- /Benchmark/obj/demo_pack_gzip_compress_with_base64/css/style.css: -------------------------------------------------------------------------------- 1 | #accordion_data div 2 | { 3 | max-height: 200px; 4 | } 5 | .size 6 | { 7 | font-family: monospace; 8 | font-size: 20px; 9 | font-weight: bold; 10 | } 11 | .code 12 | { 13 | font-family: monospace; 14 | font-size: 9px; 15 | } 16 | .fright 17 | { 18 | float: right; 19 | width: 300px; 20 | } 21 | #accordion_usage .ui-accordion-header 22 | { 23 | height: 50px; 24 | } 25 | input[type=button], input[type=submit] 26 | { 27 | font-size: 11px; 28 | } 29 | form div 30 | { 31 | font-size: 12px; 32 | } 33 | ul 34 | { 35 | list-style-type: none; 36 | margin: 0; 37 | padding: 0; 38 | } -------------------------------------------------------------------------------- /Benchmark/obj2/demo_pack_gzip_compress_with_base64/css/style.css: -------------------------------------------------------------------------------- 1 | #accordion_data div 2 | { 3 | max-height: 200px; 4 | } 5 | .size 6 | { 7 | font-family: monospace; 8 | font-size: 20px; 9 | font-weight: bold; 10 | } 11 | .code 12 | { 13 | font-family: monospace; 14 | font-size: 9px; 15 | } 16 | .fright 17 | { 18 | float: right; 19 | width: 300px; 20 | } 21 | #accordion_usage .ui-accordion-header 22 | { 23 | height: 50px; 24 | } 25 | input[type=button], input[type=submit] 26 | { 27 | font-size: 11px; 28 | } 29 | form div 30 | { 31 | font-size: 12px; 32 | } 33 | ul 34 | { 35 | list-style-type: none; 36 | margin: 0; 37 | padding: 0; 38 | } -------------------------------------------------------------------------------- /Benchmark/obj/demo_pack_gzip_compress_without_base64/css/style.css: -------------------------------------------------------------------------------- 1 | #accordion_data div 2 | { 3 | max-height: 200px; 4 | } 5 | .size 6 | { 7 | font-family: monospace; 8 | font-size: 20px; 9 | font-weight: bold; 10 | } 11 | .code 12 | { 13 | font-family: monospace; 14 | font-size: 9px; 15 | } 16 | .fright 17 | { 18 | float: right; 19 | width: 300px; 20 | } 21 | #accordion_usage .ui-accordion-header 22 | { 23 | height: 50px; 24 | } 25 | input[type=button], input[type=submit] 26 | { 27 | font-size: 11px; 28 | } 29 | form div 30 | { 31 | font-size: 12px; 32 | } 33 | ul 34 | { 35 | list-style-type: none; 36 | margin: 0; 37 | padding: 0; 38 | } -------------------------------------------------------------------------------- /Benchmark/obj/demo_simple_json_stringify_with_base64/css/style.css: -------------------------------------------------------------------------------- 1 | #accordion_data div 2 | { 3 | max-height: 200px; 4 | } 5 | .size 6 | { 7 | font-family: monospace; 8 | font-size: 20px; 9 | font-weight: bold; 10 | } 11 | .code 12 | { 13 | font-family: monospace; 14 | font-size: 9px; 15 | } 16 | .fright 17 | { 18 | float: right; 19 | width: 300px; 20 | } 21 | #accordion_usage .ui-accordion-header 22 | { 23 | height: 50px; 24 | } 25 | input[type=button], input[type=submit] 26 | { 27 | font-size: 11px; 28 | } 29 | form div 30 | { 31 | font-size: 12px; 32 | } 33 | ul 34 | { 35 | list-style-type: none; 36 | margin: 0; 37 | padding: 0; 38 | } -------------------------------------------------------------------------------- /Benchmark/obj2/demo_pack_gzip_compress_without_base64/css/style.css: -------------------------------------------------------------------------------- 1 | #accordion_data div 2 | { 3 | max-height: 200px; 4 | } 5 | .size 6 | { 7 | font-family: monospace; 8 | font-size: 20px; 9 | font-weight: bold; 10 | } 11 | .code 12 | { 13 | font-family: monospace; 14 | font-size: 9px; 15 | } 16 | .fright 17 | { 18 | float: right; 19 | width: 300px; 20 | } 21 | #accordion_usage .ui-accordion-header 22 | { 23 | height: 50px; 24 | } 25 | input[type=button], input[type=submit] 26 | { 27 | font-size: 11px; 28 | } 29 | form div 30 | { 31 | font-size: 12px; 32 | } 33 | ul 34 | { 35 | list-style-type: none; 36 | margin: 0; 37 | padding: 0; 38 | } -------------------------------------------------------------------------------- /Benchmark/obj2/demo_simple_json_stringify_with_base64/css/style.css: -------------------------------------------------------------------------------- 1 | #accordion_data div 2 | { 3 | max-height: 200px; 4 | } 5 | .size 6 | { 7 | font-family: monospace; 8 | font-size: 20px; 9 | font-weight: bold; 10 | } 11 | .code 12 | { 13 | font-family: monospace; 14 | font-size: 9px; 15 | } 16 | .fright 17 | { 18 | float: right; 19 | width: 300px; 20 | } 21 | #accordion_usage .ui-accordion-header 22 | { 23 | height: 50px; 24 | } 25 | input[type=button], input[type=submit] 26 | { 27 | font-size: 11px; 28 | } 29 | form div 30 | { 31 | font-size: 12px; 32 | } 33 | ul 34 | { 35 | list-style-type: none; 36 | margin: 0; 37 | padding: 0; 38 | } -------------------------------------------------------------------------------- /php/GzipJSON.php: -------------------------------------------------------------------------------- 1 | decode_gzip( utf8_decode( base64_decode($data) ) ) ); 26 | if ( is_null( $json ) ) 27 | { 28 | $json = json_decode( $data ); 29 | } 30 | return $json; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Benchmark/obj/demo_pack_gzip_without_base64/GzipJSON.php: -------------------------------------------------------------------------------- 1 | decode_gzip( utf8_decode( $data ) ) ); 26 | if ( is_null( $json ) ) 27 | { 28 | $json = json_decode( $data ); 29 | } 30 | return $json; 31 | } 32 | } -------------------------------------------------------------------------------- /Benchmark/obj2/demo_pack_gzip_without_base64/GzipJSON.php: -------------------------------------------------------------------------------- 1 | decode_gzip( utf8_decode( $data ) ) ); 26 | if ( is_null( $json ) ) 27 | { 28 | $json = json_decode( $data ); 29 | } 30 | return $json; 31 | } 32 | } -------------------------------------------------------------------------------- /Benchmark/obj/demo_pack_gzip_compress_without_base64/GzipJSON.php: -------------------------------------------------------------------------------- 1 | decode_gzip( utf8_decode( $data ) )); 26 | if ( is_null( $json ) ) 27 | { 28 | $json = json_decode( $data ); 29 | } 30 | return $json; 31 | } 32 | } -------------------------------------------------------------------------------- /Benchmark/obj/demo_simple_json_stringify_with_base64/GzipJSON.php: -------------------------------------------------------------------------------- 1 | decode_gzip( utf8_decode( $data ) )); 26 | if ( is_null( $json ) ) 27 | { 28 | $json = json_decode( $data ); 29 | } 30 | return $json; 31 | } 32 | } -------------------------------------------------------------------------------- /Benchmark/obj2/demo_pack_gzip_compress_without_base64/GzipJSON.php: -------------------------------------------------------------------------------- 1 | decode_gzip( utf8_decode( $data ) )); 26 | if ( is_null( $json ) ) 27 | { 28 | $json = json_decode( $data ); 29 | } 30 | return $json; 31 | } 32 | } -------------------------------------------------------------------------------- /Benchmark/obj2/demo_simple_json_stringify_with_base64/GzipJSON.php: -------------------------------------------------------------------------------- 1 | decode_gzip( utf8_decode( $data ) )); 26 | if ( is_null( $json ) ) 27 | { 28 | $json = json_decode( $data ); 29 | } 30 | return $json; 31 | } 32 | } -------------------------------------------------------------------------------- /Benchmark/obj/demo_pack_gzip_with_base64/GzipJSON.php: -------------------------------------------------------------------------------- 1 | decode_gzip( utf8_decode( base64_decode( $data ) ) )); 26 | if ( is_null( $json ) ) 27 | { 28 | $json = json_decode( $data ); 29 | } 30 | return $json; 31 | } 32 | } -------------------------------------------------------------------------------- /Benchmark/obj/demo_simple_json_stringify/GzipJSON.php: -------------------------------------------------------------------------------- 1 | decode_gzip( utf8_decode( base64_decode( $data ) ) ) ); 26 | if ( is_null( $json ) ) 27 | { 28 | $json = json_decode( $data ); 29 | } 30 | return $json; 31 | } 32 | } -------------------------------------------------------------------------------- /Benchmark/obj2/demo_pack_gzip_with_base64/GzipJSON.php: -------------------------------------------------------------------------------- 1 | decode_gzip( utf8_decode( base64_decode( $data ) ) )); 26 | if ( is_null( $json ) ) 27 | { 28 | $json = json_decode( $data ); 29 | } 30 | return $json; 31 | } 32 | } -------------------------------------------------------------------------------- /Benchmark/obj2/demo_simple_json_stringify/GzipJSON.php: -------------------------------------------------------------------------------- 1 | decode_gzip( utf8_decode( base64_decode( $data ) ) ) ); 26 | if ( is_null( $json ) ) 27 | { 28 | $json = json_decode( $data ); 29 | } 30 | return $json; 31 | } 32 | } -------------------------------------------------------------------------------- /Benchmark/obj/demo_pack_gzip_compress_with_base64/GzipJSON.php: -------------------------------------------------------------------------------- 1 | decode_gzip( utf8_decode( base64_decode( $data ) ) )); 26 | if ( is_null( $json ) ) 27 | { 28 | $json = json_decode( $data ); 29 | } 30 | return $json; 31 | } 32 | } -------------------------------------------------------------------------------- /Benchmark/obj2/demo_pack_gzip_compress_with_base64/GzipJSON.php: -------------------------------------------------------------------------------- 1 | decode_gzip( utf8_decode( base64_decode( $data ) ) )); 26 | if ( is_null( $json ) ) 27 | { 28 | $json = json_decode( $data ); 29 | } 30 | return $json; 31 | } 32 | } -------------------------------------------------------------------------------- /changelog.txt: -------------------------------------------------------------------------------- 1 | 1.6.1 2 | Make improvement in _numberToKeys for objects with a lot of different keys. 3 | 1.6.0 4 | Checking in Fiddler have been found a problem with a simple Gzip version, if Gzipped when the data is transported 5 | via POST it's url encoded and it makes grow the final size being transported, to fix it a Base64 encode has been added. 6 | 1.5.0 7 | Change the compression library from lz-string to gzip.js to make it simpler to be implemented in server side 8 | Added the PHP class to inflate the compressed data in PHP server. 9 | Replace the static example demo with a dynamic demo to be used in a PHP server. 10 | 1.0.0 11 | Change the API name of getJSONFromLZWString and getLZWStringFromJSON to pack and unpack that are more readable. 12 | 0.3.0 13 | Add new methods to allow the user to compress JSON objects using LZW even if the objects are not been compressed using 14 | JSONC.compress. 15 | 0.0.1 16 | First Commit -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT LICENSE 2 | Copyright (c) 2013 Tomás Corral Casas 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | 6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | 8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jsoncomp", 3 | "version": "1.6.1", 4 | "description": "Compress your JSON to send and get a lot of data to/from server", 5 | "homepage": "http://tcorral.github.com/JSONC/", 6 | "author": "Tomas Corral", 7 | "main": "./src/JSONC.js", 8 | "keywords": [ 9 | "JSON", 10 | "compression" 11 | ], 12 | "licenses": [ 13 | { 14 | "type": "MIT", 15 | "url": "http://www.opensource.org/licenses/mit-license.php" 16 | } 17 | ], 18 | "bugs": { 19 | "mail": "amischol@gmail.com", 20 | "url": "https://github.com/tcorral/JSONC/issues" 21 | }, 22 | "repository": { 23 | "type": "git", 24 | "url": "https://github.com/tcorral/JSONC.git" 25 | }, 26 | "scripts": { 27 | "test": "karma start --single-run --browsers PhantomJS" 28 | }, 29 | "devDependencies": { 30 | "grunt": "1.0.1", 31 | "grunt-contrib-compress": "1.4.1", 32 | "grunt-contrib-concat": "1.0.1", 33 | "grunt-contrib-copy": "1.0.0", 34 | "grunt-contrib-jshint": "1.1.0", 35 | "grunt-contrib-uglify": "2.2.1", 36 | "grunt-karma": "2.0.0", 37 | "jasmine-core": "^2.5.2", 38 | "karma": "1.5.0", 39 | "karma-chrome-launcher": "2.0.0", 40 | "karma-coffee-preprocessor": "1.0.1", 41 | "karma-coverage": "1.1.1", 42 | "karma-firefox-launcher": "1.0.1", 43 | "karma-html2js-preprocessor": "1.1.0", 44 | "karma-jasmine": "1.1.0", 45 | "karma-junit-reporter": "1.2.0", 46 | "karma-phantomjs-launcher": "1.0.4", 47 | "karma-requirejs": "1.1.0", 48 | "karma-script-launcher": "1.0.0" 49 | }, 50 | "github": "https://github.com/tcorral/JSONC" 51 | } 52 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | module.exports = function(config) { 2 | config.set({ 3 | // base path, that will be used to resolve files and exclude 4 | basePath: '', 5 | 6 | frameworks: ['jasmine'], 7 | 8 | // list of files / patterns to load in the browser 9 | files: [ 10 | 'src/*.js', 11 | 'test/*.js' 12 | ], 13 | 14 | // list of files to exclude 15 | exclude: [], 16 | preprocessors: { 17 | 'src/*.js': ['coverage'] 18 | }, 19 | // use dots reporter, as travis terminal does not support escaping sequences 20 | // possible values: 'dots', 'progress' 21 | // CLI --reporters progress 22 | reporters: ['progress', 'junit', 'coverage'], 23 | 24 | junitReporter: { 25 | // will be resolved to basePath (in the same way as files/exclude patterns) 26 | outputFile: 'test-results.xml' 27 | }, 28 | 29 | // web server port 30 | // CLI --port 9876 31 | port: 9880, 32 | 33 | // enable / disable colors in the output (reporters and logs) 34 | // CLI --colors --no-colors 35 | colors: true, 36 | 37 | // level of logging 38 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG 39 | // CLI --log-level debug 40 | logLevel: config.LOG_INFO, 41 | 42 | // enable / disable watching file and executing tests whenever any file changes 43 | // CLI --auto-watch --no-auto-watch 44 | autoWatch: true, 45 | 46 | // Start these browsers, currently available: 47 | // - Chrome 48 | // - ChromeCanary 49 | // - Firefox 50 | // - Opera 51 | // - Safari (only Mac) 52 | // - PhantomJS 53 | // - IE (only Windows) 54 | // CLI --browsers Chrome,Firefox,Safari 55 | browsers: ['PhantomJS'], 56 | 57 | // If browser does not capture in given timeout [ms], kill it 58 | // CLI --capture-timeout 5000 59 | captureTimeout: 20000, 60 | 61 | // Auto run tests on start (when browsers are captured) and exit 62 | // CLI --single-run --no-single-run 63 | singleRun: true, 64 | 65 | // report which specs are slower than 500ms 66 | // CLI --report-slower-than 500 67 | reportSlowerThan: 500, 68 | 69 | plugins: [ 70 | 'karma-jasmine', 71 | 'karma-chrome-launcher', 72 | 'karma-firefox-launcher', 73 | 'karma-junit-reporter', 74 | 'karma-coverage', 75 | 'karma-phantomjs-launcher' 76 | ] 77 | }); 78 | }; -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | module.exports = function (grunt) { 2 | 3 | var readOptionalJSON = function (filepath) { 4 | var data = {}; 5 | try { 6 | data = grunt.file.readJSON(filepath); 7 | } catch (e) {} 8 | return data; 9 | }, 10 | srcHintOptions = readOptionalJSON('src/.jshintrc'); 11 | // Project configuration. 12 | grunt.initConfig({ 13 | pkg: grunt.file.readJSON('package.json'), 14 | jshint: { 15 | dist: { 16 | src: [ "src/JSONC.js" ], 17 | options: srcHintOptions 18 | } 19 | }, 20 | karma: { 21 | unit: { 22 | configFile: 'karma.conf.js' 23 | } 24 | }, 25 | concat: { 26 | options: { 27 | separator: ';' 28 | }, 29 | dist: { 30 | src: ['vendor/base64.js', 'vendor/crc32.js', 'vendor/rawdeflate.js', 'vendor/rawinflate.js', 'vendor/gzip.js', 'src/JSONC.js'], 31 | dest: 'versions/jsonc.js' 32 | } 33 | }, 34 | uglify: { 35 | options: { 36 | banner: '/*! JSONC.js v<%= pkg.version %> | Date:<%= grunt.template.today("yyyy-mm-dd") %> |' + 37 | ' License: https://raw.github.com/tcorral/JSONC/master/LICENSE|' + 38 | ' (c) 2013\n' + 39 | '//@ sourceMappingURL=jsonc.min.map\n' + 40 | '*/\n', 41 | preserveComments: "some", 42 | sourceMap: 'versions/jsonc.min.map', 43 | sourceMappingURL: "jsonc.min.map", 44 | report: "min", 45 | beautify: { 46 | ascii_only: true 47 | }, 48 | compress: { 49 | hoist_funs: false, 50 | join_vars: false, 51 | loops: false, 52 | unused: false 53 | }, 54 | mangle: { 55 | // saves some bytes when gzipped 56 | except: [ "undefined" ] 57 | } 58 | }, 59 | build: { 60 | src: ['versions/jsonc.js'], 61 | dest: 'versions/jsonc.min.js' 62 | } 63 | }, 64 | compress: { 65 | main: { 66 | options: { 67 | mode: 'gzip' 68 | }, 69 | expand: true, 70 | cwd: 'versions/', 71 | src: ['jsonc.min.js'], 72 | dest: 'versions/' 73 | } 74 | } 75 | }); 76 | 77 | // Load the plugins 78 | grunt.loadNpmTasks("grunt-contrib-jshint"); 79 | grunt.loadNpmTasks('grunt-karma'); 80 | grunt.loadNpmTasks('grunt-contrib-concat'); 81 | grunt.loadNpmTasks('grunt-contrib-uglify'); 82 | grunt.loadNpmTasks('grunt-contrib-compress'); 83 | 84 | // Default task(s). 85 | grunt.registerTask('default', ['jshint', 'karma', 'concat', 'uglify', 'compress']); 86 | }; -------------------------------------------------------------------------------- /vendor/crc32.js: -------------------------------------------------------------------------------- 1 | void function(global, callback) { 2 | if (typeof module === 'object') { 3 | module.exports = callback(); 4 | } else if (typeof define === 'function') { 5 | define(callback); 6 | } else { 7 | global.crc32 = callback(); 8 | } 9 | }(this, function() { 10 | 'use strict'; 11 | 12 | var table = [], 13 | poly = 0xEDB88320; // reverse polynomial 14 | 15 | // build the table 16 | function makeTable() { 17 | var c, n, k; 18 | 19 | for (n = 0; n < 256; n += 1) { 20 | c = n; 21 | for (k = 0; k < 8; k += 1) { 22 | if (c & 1) { 23 | c = poly ^ (c >>> 1); 24 | } else { 25 | c = c >>> 1; 26 | } 27 | } 28 | table[n] = c >>> 0; 29 | } 30 | } 31 | 32 | function strToArr(str) { 33 | // sweet hack to turn string into a 'byte' array 34 | return Array.prototype.map.call(str, function (c) { 35 | return c.charCodeAt(0); 36 | }); 37 | } 38 | 39 | /* 40 | * Compute CRC of array directly. 41 | * 42 | * This is slower for repeated calls, so append mode is not supported. 43 | */ 44 | function crcDirect(arr) { 45 | var crc = -1, // initial contents of LFBSR 46 | i, j, l, temp; 47 | 48 | for (i = 0, l = arr.length; i < l; i += 1) { 49 | temp = (crc ^ arr[i]) & 0xff; 50 | 51 | // read 8 bits one at a time 52 | for (j = 0; j < 8; j += 1) { 53 | if ((temp & 1) === 1) { 54 | temp = (temp >>> 1) ^ poly; 55 | } else { 56 | temp = (temp >>> 1); 57 | } 58 | } 59 | crc = (crc >>> 8) ^ temp; 60 | } 61 | 62 | // flip bits 63 | return crc ^ -1; 64 | } 65 | 66 | /* 67 | * Compute CRC with the help of a pre-calculated table. 68 | * 69 | * This supports append mode, if the second parameter is set. 70 | */ 71 | function crcTable(arr, append) { 72 | var crc, i, l; 73 | 74 | // if we're in append mode, don't reset crc 75 | // if arr is null or undefined, reset table and return 76 | if (typeof crcTable.crc === 'undefined' || !append || !arr) { 77 | crcTable.crc = 0 ^ -1; 78 | 79 | if (!arr) { 80 | return; 81 | } 82 | } 83 | 84 | // store in temp variable for minor speed gain 85 | crc = crcTable.crc; 86 | 87 | for (i = 0, l = arr.length; i < l; i += 1) { 88 | crc = (crc >>> 8) ^ table[(crc ^ arr[i]) & 0xff]; 89 | } 90 | 91 | crcTable.crc = crc; 92 | 93 | return crc ^ -1; 94 | } 95 | 96 | // build the table 97 | // this isn't that costly, and most uses will be for table assisted mode 98 | makeTable(); 99 | 100 | var exports = function (val, direct) { 101 | var val = (typeof val === 'string') ? strToArr(val) : val, 102 | ret = direct ? crcDirect(val) : crcTable(val); 103 | 104 | // convert to 2's complement hex 105 | return (ret >>> 0).toString(16); 106 | }; 107 | exports.direct = crcDirect; 108 | exports.table = crcTable; 109 | 110 | return exports; 111 | }); -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | JSONC 2 | ===== 3 | # Update to version 1.6.1 4 | 5 | [![Build Status](https://travis-ci.org/tcorral/JSONC.png)](https://travis-ci.org/tcorral/JSONC) 6 | 7 | [Changelog](https://raw.github.com/tcorral/JSONC/master/changelog.txt) 8 | 9 | ## Background 10 | 11 | One of the problems you can have developing rich internet applications (RIA) using Javascript is the amount of data being transported to 12 | and from the server. 13 | When data comes from server, this data could be GZipped, but this is not possible when the big amount of data comes from 14 | the browser to the server. 15 | 16 | ##### JSONC is born to change the way browser vendors think and become an standard when send information to the server efficiently. 17 | 18 | 19 | JSONC has two differents approaches to reduce the size of the amount of data to be transported: 20 | 21 | * *JSONC.compress* - Compress JSON objects using a map to reduce the size of the keys in JSON objects. 22 | * Be careful with this method because it's really impressive if you use it with a JSON with a big amount of data, but it 23 | could be awful if you use it to compress JSON objects with small amount of data because it could increase the final size. 24 | * The rate compression could variate from 7.5% to 32.81% depending of the type and values of data. 25 | * *JSONC.pack* - Compress JSON objects using GZIP compression algorithm, to make the job JSONC uses a modification to 26 | use the gzip library and it encodes the gzipped string with Base64 to avoid url encode. 27 | * Gzip - @beatgammit - https://github.com/beatgammit/gzip-js 28 | * Base64 - http://www.webtoolkit.info/ 29 | * You can use pack to compress any JSON objects even if these objects are not been compressed using JSONC 30 | See Usage for more details. 31 | 32 | ## Usage 33 | 34 | #### Compress a JSON object: 35 | 36 | // Returns a JSON object but compressed. 37 | var compressedJSON = JSONC.compress( json ); 38 | 39 | #### Decompress a JSON object: 40 | 41 | // Returns the original JSON object. 42 | var json = JSONC.decompress( compressedJSON ); 43 | 44 | #### Compress a normal JSON object as a Gzipped string: 45 | 46 | // Returns the LZW representation as string of the JSON object. 47 | var lzwString = JSONC.pack( json ); 48 | 49 | #### Compress a JSON object as a Gzipped string after compress it using JSONC: 50 | 51 | // Returns the LZW representation as string of the JSON object. 52 | var lzwString = JSONC.pack( json, true ); 53 | 54 | #### Decompress a normal JSON object from a Gzipped string: 55 | 56 | // Returns the original JSON object. 57 | var json = JSONC.unpack( gzippedString ); 58 | 59 | #### Decompress a JSON compressed object using JSONC from a Gzipped string: 60 | 61 | // Returns the original JSON object. 62 | var json = JSONC.unpack( gzippedString, true ); 63 | 64 | ## Examples of compression 65 | 66 | #### Example data.js. 67 | 68 | Original - 17331 bytes 69 | Compressed using JSONC - 16025 bytes 70 | Compression rate - 7.5% 71 | 72 | 73 | Original compressed using gzip.js - 5715 bytes 74 | Compressed using JSONC using gzip.js - 5761 bytes 75 | 76 | 77 | Compression rate from original to compressed using JSONC and gzip.js - 66.76% 78 | 79 | #### Example data2.js. 80 | 81 | Original - 19031 bytes 82 | Compressed using JSONC - 12787 bytes 83 | Compression rate - 32.81% 84 | 85 | 86 | Original compressed using gzip.js - 4279 bytes 87 | Compressed using JSONC using gzip.js - 4664 bytes 88 | 89 | 90 | Compression rate from original to compressed using JSONC and gzip.js - 75.49% 91 | 92 | ## Next steps 93 | #### Implement the gzip class in different languages (Java, Ruby...) 94 | -------------------------------------------------------------------------------- /vendor/base64.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Base64 encode / decode 4 | * http://www.webtoolkit.info/ 5 | * 6 | **/ 7 | 8 | var Base64 = { 9 | 10 | // private property 11 | _keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", 12 | 13 | // public method for encoding 14 | encode : function (input) { 15 | var output = ""; 16 | var chr1, chr2, chr3, enc1, enc2, enc3, enc4; 17 | var i = 0; 18 | 19 | input = Base64._utf8_encode(input); 20 | 21 | while (i < input.length) { 22 | 23 | chr1 = input.charCodeAt(i++); 24 | chr2 = input.charCodeAt(i++); 25 | chr3 = input.charCodeAt(i++); 26 | 27 | enc1 = chr1 >> 2; 28 | enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); 29 | enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); 30 | enc4 = chr3 & 63; 31 | 32 | if (isNaN(chr2)) { 33 | enc3 = enc4 = 64; 34 | } else if (isNaN(chr3)) { 35 | enc4 = 64; 36 | } 37 | 38 | output = output + 39 | this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + 40 | this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4); 41 | 42 | } 43 | 44 | return output; 45 | }, 46 | 47 | // public method for decoding 48 | decode : function (input) { 49 | var output = ""; 50 | var chr1, chr2, chr3; 51 | var enc1, enc2, enc3, enc4; 52 | var i = 0; 53 | 54 | input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); 55 | 56 | while (i < input.length) { 57 | 58 | enc1 = this._keyStr.indexOf(input.charAt(i++)); 59 | enc2 = this._keyStr.indexOf(input.charAt(i++)); 60 | enc3 = this._keyStr.indexOf(input.charAt(i++)); 61 | enc4 = this._keyStr.indexOf(input.charAt(i++)); 62 | 63 | chr1 = (enc1 << 2) | (enc2 >> 4); 64 | chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); 65 | chr3 = ((enc3 & 3) << 6) | enc4; 66 | 67 | output = output + String.fromCharCode(chr1); 68 | 69 | if (enc3 != 64) { 70 | output = output + String.fromCharCode(chr2); 71 | } 72 | if (enc4 != 64) { 73 | output = output + String.fromCharCode(chr3); 74 | } 75 | 76 | } 77 | 78 | output = Base64._utf8_decode(output); 79 | 80 | return output; 81 | 82 | }, 83 | 84 | // private method for UTF-8 encoding 85 | _utf8_encode : function (string) { 86 | string = string.replace(/\r\n/g,"\n"); 87 | var utftext = ""; 88 | 89 | for (var n = 0; n < string.length; n++) { 90 | 91 | var c = string.charCodeAt(n); 92 | 93 | if (c < 128) { 94 | utftext += String.fromCharCode(c); 95 | } 96 | else if((c > 127) && (c < 2048)) { 97 | utftext += String.fromCharCode((c >> 6) | 192); 98 | utftext += String.fromCharCode((c & 63) | 128); 99 | } 100 | else { 101 | utftext += String.fromCharCode((c >> 12) | 224); 102 | utftext += String.fromCharCode(((c >> 6) & 63) | 128); 103 | utftext += String.fromCharCode((c & 63) | 128); 104 | } 105 | 106 | } 107 | 108 | return utftext; 109 | }, 110 | 111 | // private method for UTF-8 decoding 112 | _utf8_decode : function (utftext) { 113 | var string = ""; 114 | var i = 0; 115 | var c = c1 = c2 = 0; 116 | 117 | while ( i < utftext.length ) { 118 | 119 | c = utftext.charCodeAt(i); 120 | 121 | if (c < 128) { 122 | string += String.fromCharCode(c); 123 | i++; 124 | } 125 | else if((c > 191) && (c < 224)) { 126 | c2 = utftext.charCodeAt(i+1); 127 | string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); 128 | i += 2; 129 | } 130 | else { 131 | c2 = utftext.charCodeAt(i+1); 132 | c3 = utftext.charCodeAt(i+2); 133 | string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); 134 | i += 3; 135 | } 136 | 137 | } 138 | 139 | return string; 140 | } 141 | 142 | } -------------------------------------------------------------------------------- /Benchmark/obj/demo_pack_gzip_compress_with_base64/js/app.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | $( "#accordion_data, #accordion_usage, #accordion_server" ).accordion( { active: false, collapsible: true } ); 3 | $("#clean_compress_json_data_button").click(function() 4 | { 5 | $("#results_compress_json_data").html(""); 6 | return false; 7 | }); 8 | $("#compress_json_data_1_button").click(function(event) 9 | { 10 | var compressedJSON = JSONC.compress( obj ); 11 | var stringCompressedJSON = JSON.stringify(compressedJSON); 12 | $("#results_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 13 | return false; 14 | }); 15 | $("#compress_json_data_2_button").click(function(event) 16 | { 17 | var compressedJSON = JSONC.compress( obj2 ); 18 | var stringCompressedJSON = JSON.stringify(compressedJSON); 19 | $("#results_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 20 | return false; 21 | }); 22 | $("#clean_pack_json_data_button").click(function() 23 | { 24 | $("#results_pack_json_data").html(""); 25 | return false; 26 | }); 27 | $("#pack_json_data_1_button").click(function(event) 28 | { 29 | var stringCompressedJSON = JSONC.pack( obj ); 30 | $("#results_pack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 31 | return false; 32 | }); 33 | $("#pack_json_data_2_button").click(function(event) 34 | { 35 | var stringCompressedJSON = JSONC.pack( obj2 ); 36 | $("#results_pack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 37 | return false; 38 | }); 39 | 40 | $("#clean_pack_compress_json_data_button").click(function() 41 | { 42 | $("#results_pack_compress_json_data").html(""); 43 | return false; 44 | }); 45 | $("#pack_compress_json_data_1_button").click(function(event) 46 | { 47 | var stringCompressedJSON = JSONC.pack( obj, true ); 48 | $("#results_pack_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 49 | return false; 50 | }); 51 | $("#pack_compress_json_data_2_button").click(function(event) 52 | { 53 | var stringCompressedJSON = JSONC.pack( obj2, true ); 54 | $("#results_pack_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 55 | return false; 56 | }); 57 | 58 | $("#clean_decompress_json_data_button").click(function() 59 | { 60 | $("#results_decompress_json_data").html(""); 61 | return false; 62 | }); 63 | $("#decompress_json_data_1_button").click(function(event) 64 | { 65 | var oComp = JSONC.compress( obj ); 66 | var stringCompressedJSON = JSON.stringify( JSONC.decompress( oComp ) ); 67 | $("#results_decompress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 68 | return false; 69 | }); 70 | $("#decompress_json_data_2_button").click(function(event) 71 | { 72 | var oComp = JSONC.compress( obj2 ); 73 | var stringCompressedJSON = JSON.stringify( JSONC.decompress( oComp ) ); 74 | $("#results_decompress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 75 | return false; 76 | }); 77 | 78 | $("#clean_unpack_json_data_button").click(function() 79 | { 80 | $("#results_unpack_json_data").html(""); 81 | return false; 82 | }); 83 | $("#unpack_json_data_1_button").click(function(event) 84 | { 85 | var gzipped = JSONC.pack( obj ); 86 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped ) ); 87 | $("#results_unpack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 88 | return false; 89 | }); 90 | $("#unpack_json_data_2_button").click(function(event) 91 | { 92 | var gzipped = JSONC.pack( obj2 ); 93 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped ) ); 94 | $("#results_unpack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 95 | return false; 96 | }); 97 | 98 | 99 | $("#clean_unpack_compress_json_data_button").click(function() 100 | { 101 | $("#results_unpack_compressed_json_data").html(""); 102 | return false; 103 | }); 104 | $("#unpack_compress_json_data_1_button").click(function(event) 105 | { 106 | var gzipped = JSONC.pack( obj, true ); 107 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped, true ) ); 108 | $("#results_unpack_compressed_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 109 | return false; 110 | }); 111 | $("#unpack_compress_json_data_2_button").click(function(event) 112 | { 113 | var gzipped = JSONC.pack( obj2, true ); 114 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped, true ) ); 115 | $("#results_unpack_compressed_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 116 | return false; 117 | }); 118 | }); 119 | $("form").submit(function(event) 120 | { 121 | var sObj, nLenObjStr, sZipped, nLenZipped; 122 | sObj = JSON.stringify( obj ); 123 | nLenObjStr = sObj.length; 124 | sZipped = JSONC.pack( obj, true ); 125 | nLenZipped = sZipped.length; 126 | 127 | console.log( 'Original:', sObj, nLenObjStr ); 128 | console.log( 'Send:', sZipped, nLenZipped ); 129 | $.ajax({ 130 | url: "/obj/demo_pack_gzip_compress_with_base64/alo.php", 131 | type: "POST", 132 | data: { json: sZipped }, 133 | dataType: 'json', 134 | success: function( data ) 135 | { 136 | document.getElementById('info_server').innerHTML = 'Press F12 to open developer tools and check the console tab'; 137 | data = JSONC.decompress( data ); //version compact 138 | console.log('Data:', data, JSON.stringify(data).length); 139 | }, 140 | error: function() 141 | { 142 | console.log.apply(console, arguments); 143 | } 144 | }); 145 | event.preventDefault(); 146 | }); -------------------------------------------------------------------------------- /Benchmark/obj/demo_pack_gzip_with_base64/js/app.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | $( "#accordion_data, #accordion_usage, #accordion_server" ).accordion( { active: false, collapsible: true } ); 3 | $("#clean_compress_json_data_button").click(function() 4 | { 5 | $("#results_compress_json_data").html(""); 6 | return false; 7 | }); 8 | $("#compress_json_data_1_button").click(function(event) 9 | { 10 | var compressedJSON = JSONC.compress( obj ); 11 | var stringCompressedJSON = JSON.stringify(compressedJSON); 12 | $("#results_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 13 | return false; 14 | }); 15 | $("#compress_json_data_2_button").click(function(event) 16 | { 17 | var compressedJSON = JSONC.compress( obj2 ); 18 | var stringCompressedJSON = JSON.stringify(compressedJSON); 19 | $("#results_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 20 | return false; 21 | }); 22 | $("#clean_pack_json_data_button").click(function() 23 | { 24 | $("#results_pack_json_data").html(""); 25 | return false; 26 | }); 27 | $("#pack_json_data_1_button").click(function(event) 28 | { 29 | var stringCompressedJSON = JSONC.pack( obj ); 30 | $("#results_pack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 31 | return false; 32 | }); 33 | $("#pack_json_data_2_button").click(function(event) 34 | { 35 | var stringCompressedJSON = JSONC.pack( obj2 ); 36 | $("#results_pack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 37 | return false; 38 | }); 39 | 40 | $("#clean_pack_compress_json_data_button").click(function() 41 | { 42 | $("#results_pack_compress_json_data").html(""); 43 | return false; 44 | }); 45 | $("#pack_compress_json_data_1_button").click(function(event) 46 | { 47 | var stringCompressedJSON = JSONC.pack( obj, true ); 48 | $("#results_pack_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 49 | return false; 50 | }); 51 | $("#pack_compress_json_data_2_button").click(function(event) 52 | { 53 | var stringCompressedJSON = JSONC.pack( obj2, true ); 54 | $("#results_pack_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 55 | return false; 56 | }); 57 | 58 | $("#clean_decompress_json_data_button").click(function() 59 | { 60 | $("#results_decompress_json_data").html(""); 61 | return false; 62 | }); 63 | $("#decompress_json_data_1_button").click(function(event) 64 | { 65 | var oComp = JSONC.compress( obj ); 66 | var stringCompressedJSON = JSON.stringify( JSONC.decompress( oComp ) ); 67 | $("#results_decompress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 68 | return false; 69 | }); 70 | $("#decompress_json_data_2_button").click(function(event) 71 | { 72 | var oComp = JSONC.compress( obj2 ); 73 | var stringCompressedJSON = JSON.stringify( JSONC.decompress( oComp ) ); 74 | $("#results_decompress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 75 | return false; 76 | }); 77 | 78 | $("#clean_unpack_json_data_button").click(function() 79 | { 80 | $("#results_unpack_json_data").html(""); 81 | return false; 82 | }); 83 | $("#unpack_json_data_1_button").click(function(event) 84 | { 85 | var gzipped = JSONC.pack( obj ); 86 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped ) ); 87 | $("#results_unpack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 88 | return false; 89 | }); 90 | $("#unpack_json_data_2_button").click(function(event) 91 | { 92 | var gzipped = JSONC.pack( obj2 ); 93 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped ) ); 94 | $("#results_unpack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 95 | return false; 96 | }); 97 | 98 | 99 | $("#clean_unpack_compress_json_data_button").click(function() 100 | { 101 | $("#results_unpack_compressed_json_data").html(""); 102 | return false; 103 | }); 104 | $("#unpack_compress_json_data_1_button").click(function(event) 105 | { 106 | var gzipped = JSONC.pack( obj, true ); 107 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped, true ) ); 108 | $("#results_unpack_compressed_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 109 | return false; 110 | }); 111 | $("#unpack_compress_json_data_2_button").click(function(event) 112 | { 113 | var gzipped = JSONC.pack( obj2, true ); 114 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped, true ) ); 115 | $("#results_unpack_compressed_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 116 | return false; 117 | }); 118 | }); 119 | $("form").submit(function(event) 120 | { 121 | var sObj, nLenObjStr, sZipped, nLenZipped; 122 | sObj = JSON.stringify( obj ); 123 | nLenObjStr = sObj.length; 124 | sZipped = JSONC.pack( obj ); 125 | //sZipped = JSONC.pack( obj, true ); //version compact 126 | nLenZipped = sZipped.length; 127 | 128 | console.log( 'Original:', sObj, sObj.length ); 129 | console.log( 'Send:', sZipped, sZipped.length ); 130 | $.ajax({ 131 | url: "/obj/demo_pack_gzip_with_base64/alo.php", 132 | type: "POST", 133 | data: { json: nLenObjStr > nLenZipped ? sZipped : sObj }, 134 | dataType: 'json', 135 | success: function( data ) 136 | { 137 | document.getElementById('info_server').innerHTML = 'Press F12 to open developer tools and check the console tab'; 138 | //data = JSONC.decompress( data ); //version compact 139 | console.log('Data:', data, JSON.stringify(data).length); 140 | }, 141 | error: function() 142 | { 143 | console.log.apply(console, arguments); 144 | } 145 | }); 146 | event.preventDefault(); 147 | }); -------------------------------------------------------------------------------- /Benchmark/obj/demo_pack_gzip_without_base64/js/app.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | $( "#accordion_data, #accordion_usage, #accordion_server" ).accordion( { active: false, collapsible: true } ); 3 | $("#clean_compress_json_data_button").click(function() 4 | { 5 | $("#results_compress_json_data").html(""); 6 | return false; 7 | }); 8 | $("#compress_json_data_1_button").click(function(event) 9 | { 10 | var compressedJSON = JSONC.compress( obj ); 11 | var stringCompressedJSON = JSON.stringify(compressedJSON); 12 | $("#results_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 13 | return false; 14 | }); 15 | $("#compress_json_data_2_button").click(function(event) 16 | { 17 | var compressedJSON = JSONC.compress( obj2 ); 18 | var stringCompressedJSON = JSON.stringify(compressedJSON); 19 | $("#results_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 20 | return false; 21 | }); 22 | $("#clean_pack_json_data_button").click(function() 23 | { 24 | $("#results_pack_json_data").html(""); 25 | return false; 26 | }); 27 | $("#pack_json_data_1_button").click(function(event) 28 | { 29 | var stringCompressedJSON = JSONC.pack( obj ); 30 | $("#results_pack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 31 | return false; 32 | }); 33 | $("#pack_json_data_2_button").click(function(event) 34 | { 35 | var stringCompressedJSON = JSONC.pack( obj2 ); 36 | $("#results_pack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 37 | return false; 38 | }); 39 | 40 | $("#clean_pack_compress_json_data_button").click(function() 41 | { 42 | $("#results_pack_compress_json_data").html(""); 43 | return false; 44 | }); 45 | $("#pack_compress_json_data_1_button").click(function(event) 46 | { 47 | var stringCompressedJSON = JSONC.pack( obj, true ); 48 | $("#results_pack_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 49 | return false; 50 | }); 51 | $("#pack_compress_json_data_2_button").click(function(event) 52 | { 53 | var stringCompressedJSON = JSONC.pack( obj2, true ); 54 | $("#results_pack_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 55 | return false; 56 | }); 57 | 58 | $("#clean_decompress_json_data_button").click(function() 59 | { 60 | $("#results_decompress_json_data").html(""); 61 | return false; 62 | }); 63 | $("#decompress_json_data_1_button").click(function(event) 64 | { 65 | var oComp = JSONC.compress( obj ); 66 | var stringCompressedJSON = JSON.stringify( JSONC.decompress( oComp ) ); 67 | $("#results_decompress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 68 | return false; 69 | }); 70 | $("#decompress_json_data_2_button").click(function(event) 71 | { 72 | var oComp = JSONC.compress( obj2 ); 73 | var stringCompressedJSON = JSON.stringify( JSONC.decompress( oComp ) ); 74 | $("#results_decompress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 75 | return false; 76 | }); 77 | 78 | $("#clean_unpack_json_data_button").click(function() 79 | { 80 | $("#results_unpack_json_data").html(""); 81 | return false; 82 | }); 83 | $("#unpack_json_data_1_button").click(function(event) 84 | { 85 | var gzipped = JSONC.pack( obj ); 86 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped ) ); 87 | $("#results_unpack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 88 | return false; 89 | }); 90 | $("#unpack_json_data_2_button").click(function(event) 91 | { 92 | var gzipped = JSONC.pack( obj2 ); 93 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped ) ); 94 | $("#results_unpack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 95 | return false; 96 | }); 97 | 98 | 99 | $("#clean_unpack_compress_json_data_button").click(function() 100 | { 101 | $("#results_unpack_compressed_json_data").html(""); 102 | return false; 103 | }); 104 | $("#unpack_compress_json_data_1_button").click(function(event) 105 | { 106 | var gzipped = JSONC.pack( obj, true ); 107 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped, true ) ); 108 | $("#results_unpack_compressed_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 109 | return false; 110 | }); 111 | $("#unpack_compress_json_data_2_button").click(function(event) 112 | { 113 | var gzipped = JSONC.pack( obj2, true ); 114 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped, true ) ); 115 | $("#results_unpack_compressed_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 116 | return false; 117 | }); 118 | }); 119 | $("form").submit(function(event) 120 | { 121 | var sObj, nLenObjStr, sZipped, nLenZipped; 122 | sObj = JSON.stringify( obj ); 123 | nLenObjStr = sObj.length; 124 | sZipped = JSONC.pack( obj ); 125 | //sZipped = JSONC.pack( obj, true ); //version compact 126 | nLenZipped = sZipped.length; 127 | 128 | console.log( 'Original:', sObj, sObj.length ); 129 | console.log( 'Send:', sZipped, sZipped.length ); 130 | $.ajax({ 131 | url: "/obj/demo_pack_gzip_without_base64/alo.php", 132 | type: "POST", 133 | data: { json: nLenObjStr > nLenZipped ? sZipped : sObj }, 134 | dataType: 'json', 135 | success: function( data ) 136 | { 137 | document.getElementById('info_server').innerHTML = 'Press F12 to open developer tools and check the console tab'; 138 | //data = JSONC.decompress( data ); //version compact 139 | console.log('Data:', data, JSON.stringify(data).length); 140 | }, 141 | error: function() 142 | { 143 | console.log.apply(console, arguments); 144 | } 145 | }); 146 | event.preventDefault(); 147 | }); -------------------------------------------------------------------------------- /Benchmark/obj2/demo_pack_gzip_with_base64/js/app.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | $( "#accordion_data, #accordion_usage, #accordion_server" ).accordion( { active: false, collapsible: true } ); 3 | $("#clean_compress_json_data_button").click(function() 4 | { 5 | $("#results_compress_json_data").html(""); 6 | return false; 7 | }); 8 | $("#compress_json_data_1_button").click(function(event) 9 | { 10 | var compressedJSON = JSONC.compress( obj ); 11 | var stringCompressedJSON = JSON.stringify(compressedJSON); 12 | $("#results_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 13 | return false; 14 | }); 15 | $("#compress_json_data_2_button").click(function(event) 16 | { 17 | var compressedJSON = JSONC.compress( obj2 ); 18 | var stringCompressedJSON = JSON.stringify(compressedJSON); 19 | $("#results_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 20 | return false; 21 | }); 22 | $("#clean_pack_json_data_button").click(function() 23 | { 24 | $("#results_pack_json_data").html(""); 25 | return false; 26 | }); 27 | $("#pack_json_data_1_button").click(function(event) 28 | { 29 | var stringCompressedJSON = JSONC.pack( obj ); 30 | $("#results_pack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 31 | return false; 32 | }); 33 | $("#pack_json_data_2_button").click(function(event) 34 | { 35 | var stringCompressedJSON = JSONC.pack( obj2 ); 36 | $("#results_pack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 37 | return false; 38 | }); 39 | 40 | $("#clean_pack_compress_json_data_button").click(function() 41 | { 42 | $("#results_pack_compress_json_data").html(""); 43 | return false; 44 | }); 45 | $("#pack_compress_json_data_1_button").click(function(event) 46 | { 47 | var stringCompressedJSON = JSONC.pack( obj, true ); 48 | $("#results_pack_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 49 | return false; 50 | }); 51 | $("#pack_compress_json_data_2_button").click(function(event) 52 | { 53 | var stringCompressedJSON = JSONC.pack( obj2, true ); 54 | $("#results_pack_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 55 | return false; 56 | }); 57 | 58 | $("#clean_decompress_json_data_button").click(function() 59 | { 60 | $("#results_decompress_json_data").html(""); 61 | return false; 62 | }); 63 | $("#decompress_json_data_1_button").click(function(event) 64 | { 65 | var oComp = JSONC.compress( obj ); 66 | var stringCompressedJSON = JSON.stringify( JSONC.decompress( oComp ) ); 67 | $("#results_decompress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 68 | return false; 69 | }); 70 | $("#decompress_json_data_2_button").click(function(event) 71 | { 72 | var oComp = JSONC.compress( obj2 ); 73 | var stringCompressedJSON = JSON.stringify( JSONC.decompress( oComp ) ); 74 | $("#results_decompress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 75 | return false; 76 | }); 77 | 78 | $("#clean_unpack_json_data_button").click(function() 79 | { 80 | $("#results_unpack_json_data").html(""); 81 | return false; 82 | }); 83 | $("#unpack_json_data_1_button").click(function(event) 84 | { 85 | var gzipped = JSONC.pack( obj ); 86 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped ) ); 87 | $("#results_unpack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 88 | return false; 89 | }); 90 | $("#unpack_json_data_2_button").click(function(event) 91 | { 92 | var gzipped = JSONC.pack( obj2 ); 93 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped ) ); 94 | $("#results_unpack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 95 | return false; 96 | }); 97 | 98 | 99 | $("#clean_unpack_compress_json_data_button").click(function() 100 | { 101 | $("#results_unpack_compressed_json_data").html(""); 102 | return false; 103 | }); 104 | $("#unpack_compress_json_data_1_button").click(function(event) 105 | { 106 | var gzipped = JSONC.pack( obj, true ); 107 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped, true ) ); 108 | $("#results_unpack_compressed_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 109 | return false; 110 | }); 111 | $("#unpack_compress_json_data_2_button").click(function(event) 112 | { 113 | var gzipped = JSONC.pack( obj2, true ); 114 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped, true ) ); 115 | $("#results_unpack_compressed_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 116 | return false; 117 | }); 118 | }); 119 | $("form").submit(function(event) 120 | { 121 | var sObj, nLenObjStr, sZipped, nLenZipped; 122 | sObj = JSON.stringify( obj2 ); 123 | nLenObjStr = sObj.length; 124 | sZipped = JSONC.pack( obj2 ); 125 | //sZipped = JSONC.pack( obj, true ); //version compact 126 | nLenZipped = sZipped.length; 127 | 128 | console.log( 'Original:', sObj, sObj.length ); 129 | console.log( 'Send:', sZipped, sZipped.length ); 130 | $.ajax({ 131 | url: "/obj2/demo_pack_gzip_with_base64/alo.php", 132 | type: "POST", 133 | data: { json: nLenObjStr > nLenZipped ? sZipped : sObj }, 134 | dataType: 'json', 135 | success: function( data ) 136 | { 137 | document.getElementById('info_server').innerHTML = 'Press F12 to open developer tools and check the console tab'; 138 | //data = JSONC.decompress( data ); //version compact 139 | console.log('Data:', data, JSON.stringify(data).length); 140 | }, 141 | error: function() 142 | { 143 | console.log.apply(console, arguments); 144 | } 145 | }); 146 | event.preventDefault(); 147 | }); -------------------------------------------------------------------------------- /Benchmark/obj2/demo_pack_gzip_without_base64/js/app.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | $( "#accordion_data, #accordion_usage, #accordion_server" ).accordion( { active: false, collapsible: true } ); 3 | $("#clean_compress_json_data_button").click(function() 4 | { 5 | $("#results_compress_json_data").html(""); 6 | return false; 7 | }); 8 | $("#compress_json_data_1_button").click(function(event) 9 | { 10 | var compressedJSON = JSONC.compress( obj ); 11 | var stringCompressedJSON = JSON.stringify(compressedJSON); 12 | $("#results_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 13 | return false; 14 | }); 15 | $("#compress_json_data_2_button").click(function(event) 16 | { 17 | var compressedJSON = JSONC.compress( obj2 ); 18 | var stringCompressedJSON = JSON.stringify(compressedJSON); 19 | $("#results_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 20 | return false; 21 | }); 22 | $("#clean_pack_json_data_button").click(function() 23 | { 24 | $("#results_pack_json_data").html(""); 25 | return false; 26 | }); 27 | $("#pack_json_data_1_button").click(function(event) 28 | { 29 | var stringCompressedJSON = JSONC.pack( obj ); 30 | $("#results_pack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 31 | return false; 32 | }); 33 | $("#pack_json_data_2_button").click(function(event) 34 | { 35 | var stringCompressedJSON = JSONC.pack( obj2 ); 36 | $("#results_pack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 37 | return false; 38 | }); 39 | 40 | $("#clean_pack_compress_json_data_button").click(function() 41 | { 42 | $("#results_pack_compress_json_data").html(""); 43 | return false; 44 | }); 45 | $("#pack_compress_json_data_1_button").click(function(event) 46 | { 47 | var stringCompressedJSON = JSONC.pack( obj, true ); 48 | $("#results_pack_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 49 | return false; 50 | }); 51 | $("#pack_compress_json_data_2_button").click(function(event) 52 | { 53 | var stringCompressedJSON = JSONC.pack( obj2, true ); 54 | $("#results_pack_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 55 | return false; 56 | }); 57 | 58 | $("#clean_decompress_json_data_button").click(function() 59 | { 60 | $("#results_decompress_json_data").html(""); 61 | return false; 62 | }); 63 | $("#decompress_json_data_1_button").click(function(event) 64 | { 65 | var oComp = JSONC.compress( obj ); 66 | var stringCompressedJSON = JSON.stringify( JSONC.decompress( oComp ) ); 67 | $("#results_decompress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 68 | return false; 69 | }); 70 | $("#decompress_json_data_2_button").click(function(event) 71 | { 72 | var oComp = JSONC.compress( obj2 ); 73 | var stringCompressedJSON = JSON.stringify( JSONC.decompress( oComp ) ); 74 | $("#results_decompress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 75 | return false; 76 | }); 77 | 78 | $("#clean_unpack_json_data_button").click(function() 79 | { 80 | $("#results_unpack_json_data").html(""); 81 | return false; 82 | }); 83 | $("#unpack_json_data_1_button").click(function(event) 84 | { 85 | var gzipped = JSONC.pack( obj ); 86 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped ) ); 87 | $("#results_unpack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 88 | return false; 89 | }); 90 | $("#unpack_json_data_2_button").click(function(event) 91 | { 92 | var gzipped = JSONC.pack( obj2 ); 93 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped ) ); 94 | $("#results_unpack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 95 | return false; 96 | }); 97 | 98 | 99 | $("#clean_unpack_compress_json_data_button").click(function() 100 | { 101 | $("#results_unpack_compressed_json_data").html(""); 102 | return false; 103 | }); 104 | $("#unpack_compress_json_data_1_button").click(function(event) 105 | { 106 | var gzipped = JSONC.pack( obj, true ); 107 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped, true ) ); 108 | $("#results_unpack_compressed_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 109 | return false; 110 | }); 111 | $("#unpack_compress_json_data_2_button").click(function(event) 112 | { 113 | var gzipped = JSONC.pack( obj2, true ); 114 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped, true ) ); 115 | $("#results_unpack_compressed_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 116 | return false; 117 | }); 118 | }); 119 | $("form").submit(function(event) 120 | { 121 | var sObj, nLenObjStr, sZipped, nLenZipped; 122 | sObj = JSON.stringify( obj2 ); 123 | nLenObjStr = sObj.length; 124 | sZipped = JSONC.pack( obj2 ); 125 | //sZipped = JSONC.pack( obj, true ); //version compact 126 | nLenZipped = sZipped.length; 127 | 128 | console.log( 'Original:', sObj, sObj.length ); 129 | console.log( 'Send:', sZipped, sZipped.length ); 130 | $.ajax({ 131 | url: "/obj2/demo_pack_gzip_without_base64/alo.php", 132 | type: "POST", 133 | data: { json: nLenObjStr > nLenZipped ? sZipped : sObj }, 134 | dataType: 'json', 135 | success: function( data ) 136 | { 137 | document.getElementById('info_server').innerHTML = 'Press F12 to open developer tools and check the console tab'; 138 | //data = JSONC.decompress( data ); //version compact 139 | console.log('Data:', data, JSON.stringify(data).length); 140 | }, 141 | error: function() 142 | { 143 | console.log.apply(console, arguments); 144 | } 145 | }); 146 | event.preventDefault(); 147 | }); -------------------------------------------------------------------------------- /Benchmark/obj/demo_pack_gzip_compress_without_base64/js/app.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | $( "#accordion_data, #accordion_usage, #accordion_server" ).accordion( { active: false, collapsible: true } ); 3 | $("#clean_compress_json_data_button").click(function() 4 | { 5 | $("#results_compress_json_data").html(""); 6 | return false; 7 | }); 8 | $("#compress_json_data_1_button").click(function(event) 9 | { 10 | var compressedJSON = JSONC.compress( obj ); 11 | var stringCompressedJSON = JSON.stringify(compressedJSON); 12 | $("#results_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 13 | return false; 14 | }); 15 | $("#compress_json_data_2_button").click(function(event) 16 | { 17 | var compressedJSON = JSONC.compress( obj2 ); 18 | var stringCompressedJSON = JSON.stringify(compressedJSON); 19 | $("#results_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 20 | return false; 21 | }); 22 | $("#clean_pack_json_data_button").click(function() 23 | { 24 | $("#results_pack_json_data").html(""); 25 | return false; 26 | }); 27 | $("#pack_json_data_1_button").click(function(event) 28 | { 29 | var stringCompressedJSON = JSONC.pack( obj ); 30 | $("#results_pack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 31 | return false; 32 | }); 33 | $("#pack_json_data_2_button").click(function(event) 34 | { 35 | var stringCompressedJSON = JSONC.pack( obj2 ); 36 | $("#results_pack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 37 | return false; 38 | }); 39 | 40 | $("#clean_pack_compress_json_data_button").click(function() 41 | { 42 | $("#results_pack_compress_json_data").html(""); 43 | return false; 44 | }); 45 | $("#pack_compress_json_data_1_button").click(function(event) 46 | { 47 | var stringCompressedJSON = JSONC.pack( obj, true ); 48 | $("#results_pack_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 49 | return false; 50 | }); 51 | $("#pack_compress_json_data_2_button").click(function(event) 52 | { 53 | var stringCompressedJSON = JSONC.pack( obj2, true ); 54 | $("#results_pack_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 55 | return false; 56 | }); 57 | 58 | $("#clean_decompress_json_data_button").click(function() 59 | { 60 | $("#results_decompress_json_data").html(""); 61 | return false; 62 | }); 63 | $("#decompress_json_data_1_button").click(function(event) 64 | { 65 | var oComp = JSONC.compress( obj ); 66 | var stringCompressedJSON = JSON.stringify( JSONC.decompress( oComp ) ); 67 | $("#results_decompress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 68 | return false; 69 | }); 70 | $("#decompress_json_data_2_button").click(function(event) 71 | { 72 | var oComp = JSONC.compress( obj2 ); 73 | var stringCompressedJSON = JSON.stringify( JSONC.decompress( oComp ) ); 74 | $("#results_decompress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 75 | return false; 76 | }); 77 | 78 | $("#clean_unpack_json_data_button").click(function() 79 | { 80 | $("#results_unpack_json_data").html(""); 81 | return false; 82 | }); 83 | $("#unpack_json_data_1_button").click(function(event) 84 | { 85 | var gzipped = JSONC.pack( obj ); 86 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped ) ); 87 | $("#results_unpack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 88 | return false; 89 | }); 90 | $("#unpack_json_data_2_button").click(function(event) 91 | { 92 | var gzipped = JSONC.pack( obj2 ); 93 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped ) ); 94 | $("#results_unpack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 95 | return false; 96 | }); 97 | 98 | 99 | $("#clean_unpack_compress_json_data_button").click(function() 100 | { 101 | $("#results_unpack_compressed_json_data").html(""); 102 | return false; 103 | }); 104 | $("#unpack_compress_json_data_1_button").click(function(event) 105 | { 106 | var gzipped = JSONC.pack( obj, true ); 107 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped, true ) ); 108 | $("#results_unpack_compressed_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 109 | return false; 110 | }); 111 | $("#unpack_compress_json_data_2_button").click(function(event) 112 | { 113 | var gzipped = JSONC.pack( obj2, true ); 114 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped, true ) ); 115 | $("#results_unpack_compressed_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 116 | return false; 117 | }); 118 | }); 119 | $("form").submit(function(event) 120 | { 121 | var sObj, nLenObjStr, sZipped, nLenZipped; 122 | sObj = JSON.stringify( obj ); 123 | nLenObjStr = sObj.length; 124 | sZipped = JSONC.pack( obj, true ); 125 | //sZipped = JSONC.pack( obj, true ); //version compact 126 | nLenZipped = sZipped.length; 127 | 128 | console.log( 'Original:', sObj, sObj.length ); 129 | console.log( 'Send:', sZipped, sZipped.length ); 130 | $.ajax({ 131 | url: "/obj/demo_pack_gzip_compress_without_base64/alo.php", 132 | type: "POST", 133 | data: { json: nLenObjStr > nLenZipped ? sZipped : sObj }, 134 | dataType: 'json', 135 | success: function( data ) 136 | { 137 | document.getElementById('info_server').innerHTML = 'Press F12 to open developer tools and check the console tab'; 138 | data = JSONC.decompress( data ); //version compact 139 | console.log('Data:', data, JSON.stringify(data).length); 140 | }, 141 | error: function() 142 | { 143 | console.log.apply(console, arguments); 144 | } 145 | }); 146 | event.preventDefault(); 147 | }); -------------------------------------------------------------------------------- /Benchmark/obj/demo_simple_json_stringify/js/app.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | $( "#accordion_data, #accordion_usage, #accordion_server" ).accordion( { active: false, collapsible: true } ); 3 | $("#clean_compress_json_data_button").click(function() 4 | { 5 | $("#results_compress_json_data").html(""); 6 | return false; 7 | }); 8 | $("#compress_json_data_1_button").click(function(event) 9 | { 10 | var compressedJSON = JSONC.compress( obj ); 11 | var stringCompressedJSON = JSON.stringify(compressedJSON); 12 | $("#results_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 13 | return false; 14 | }); 15 | $("#compress_json_data_2_button").click(function(event) 16 | { 17 | var compressedJSON = JSONC.compress( obj2 ); 18 | var stringCompressedJSON = JSON.stringify(compressedJSON); 19 | $("#results_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 20 | return false; 21 | }); 22 | $("#clean_pack_json_data_button").click(function() 23 | { 24 | $("#results_pack_json_data").html(""); 25 | return false; 26 | }); 27 | $("#pack_json_data_1_button").click(function(event) 28 | { 29 | var stringCompressedJSON = JSONC.pack( obj ); 30 | $("#results_pack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 31 | return false; 32 | }); 33 | $("#pack_json_data_2_button").click(function(event) 34 | { 35 | var stringCompressedJSON = JSONC.pack( obj2 ); 36 | $("#results_pack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 37 | return false; 38 | }); 39 | 40 | $("#clean_pack_compress_json_data_button").click(function() 41 | { 42 | $("#results_pack_compress_json_data").html(""); 43 | return false; 44 | }); 45 | $("#pack_compress_json_data_1_button").click(function(event) 46 | { 47 | var stringCompressedJSON = JSONC.pack( obj, true ); 48 | $("#results_pack_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 49 | return false; 50 | }); 51 | $("#pack_compress_json_data_2_button").click(function(event) 52 | { 53 | var stringCompressedJSON = JSONC.pack( obj2, true ); 54 | $("#results_pack_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 55 | return false; 56 | }); 57 | 58 | $("#clean_decompress_json_data_button").click(function() 59 | { 60 | $("#results_decompress_json_data").html(""); 61 | return false; 62 | }); 63 | $("#decompress_json_data_1_button").click(function(event) 64 | { 65 | var oComp = JSONC.compress( obj ); 66 | var stringCompressedJSON = JSON.stringify( JSONC.decompress( oComp ) ); 67 | $("#results_decompress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 68 | return false; 69 | }); 70 | $("#decompress_json_data_2_button").click(function(event) 71 | { 72 | var oComp = JSONC.compress( obj2 ); 73 | var stringCompressedJSON = JSON.stringify( JSONC.decompress( oComp ) ); 74 | $("#results_decompress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 75 | return false; 76 | }); 77 | 78 | $("#clean_unpack_json_data_button").click(function() 79 | { 80 | $("#results_unpack_json_data").html(""); 81 | return false; 82 | }); 83 | $("#unpack_json_data_1_button").click(function(event) 84 | { 85 | var gzipped = JSONC.pack( obj ); 86 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped ) ); 87 | $("#results_unpack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 88 | return false; 89 | }); 90 | $("#unpack_json_data_2_button").click(function(event) 91 | { 92 | var gzipped = JSONC.pack( obj2 ); 93 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped ) ); 94 | $("#results_unpack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 95 | return false; 96 | }); 97 | 98 | 99 | $("#clean_unpack_compress_json_data_button").click(function() 100 | { 101 | $("#results_unpack_compressed_json_data").html(""); 102 | return false; 103 | }); 104 | $("#unpack_compress_json_data_1_button").click(function(event) 105 | { 106 | var gzipped = JSONC.pack( obj, true ); 107 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped, true ) ); 108 | $("#results_unpack_compressed_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 109 | return false; 110 | }); 111 | $("#unpack_compress_json_data_2_button").click(function(event) 112 | { 113 | var gzipped = JSONC.pack( obj2, true ); 114 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped, true ) ); 115 | $("#results_unpack_compressed_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 116 | return false; 117 | }); 118 | }); 119 | $("form").submit(function(event) 120 | { 121 | var sObj, nLenObjStr, sZipped, nLenZipped; 122 | sObj = JSON.stringify( obj ); 123 | nLenObjStr = sObj.length; 124 | sZipped = JSONC.pack( obj ); 125 | //sZipped = JSONC.pack( obj, true ); //version compact 126 | nLenZipped = sZipped.length; 127 | 128 | console.log( 'Original:', sObj, sObj.length ); 129 | console.log( 'Send:', sZipped, sZipped.length ); 130 | $.ajax({ 131 | url: "/obj/demo_simple_json_stringify/alo.php", 132 | type: "POST", 133 | data: { json: JSON.stringify( obj ) },//nLenObjStr > nLenZipped ? sZipped : sObj }, 134 | dataType: 'json', 135 | success: function( data ) 136 | { 137 | document.getElementById('info_server').innerHTML = 'Press F12 to open developer tools and check the console tab'; 138 | //data = JSONC.decompress( data ); //version compact 139 | console.log('Data:', data, JSON.stringify(data).length); 140 | }, 141 | error: function() 142 | { 143 | console.log.apply(console, arguments); 144 | } 145 | }); 146 | event.preventDefault(); 147 | }); -------------------------------------------------------------------------------- /Benchmark/obj2/demo_pack_gzip_compress_with_base64/js/app.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | $( "#accordion_data, #accordion_usage, #accordion_server" ).accordion( { active: false, collapsible: true } ); 3 | $("#clean_compress_json_data_button").click(function() 4 | { 5 | $("#results_compress_json_data").html(""); 6 | return false; 7 | }); 8 | $("#compress_json_data_1_button").click(function(event) 9 | { 10 | var compressedJSON = JSONC.compress( obj ); 11 | var stringCompressedJSON = JSON.stringify(compressedJSON); 12 | $("#results_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 13 | return false; 14 | }); 15 | $("#compress_json_data_2_button").click(function(event) 16 | { 17 | var compressedJSON = JSONC.compress( obj2 ); 18 | var stringCompressedJSON = JSON.stringify(compressedJSON); 19 | $("#results_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 20 | return false; 21 | }); 22 | $("#clean_pack_json_data_button").click(function() 23 | { 24 | $("#results_pack_json_data").html(""); 25 | return false; 26 | }); 27 | $("#pack_json_data_1_button").click(function(event) 28 | { 29 | var stringCompressedJSON = JSONC.pack( obj ); 30 | $("#results_pack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 31 | return false; 32 | }); 33 | $("#pack_json_data_2_button").click(function(event) 34 | { 35 | var stringCompressedJSON = JSONC.pack( obj2 ); 36 | $("#results_pack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 37 | return false; 38 | }); 39 | 40 | $("#clean_pack_compress_json_data_button").click(function() 41 | { 42 | $("#results_pack_compress_json_data").html(""); 43 | return false; 44 | }); 45 | $("#pack_compress_json_data_1_button").click(function(event) 46 | { 47 | var stringCompressedJSON = JSONC.pack( obj, true ); 48 | $("#results_pack_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 49 | return false; 50 | }); 51 | $("#pack_compress_json_data_2_button").click(function(event) 52 | { 53 | var stringCompressedJSON = JSONC.pack( obj2, true ); 54 | $("#results_pack_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 55 | return false; 56 | }); 57 | 58 | $("#clean_decompress_json_data_button").click(function() 59 | { 60 | $("#results_decompress_json_data").html(""); 61 | return false; 62 | }); 63 | $("#decompress_json_data_1_button").click(function(event) 64 | { 65 | var oComp = JSONC.compress( obj ); 66 | var stringCompressedJSON = JSON.stringify( JSONC.decompress( oComp ) ); 67 | $("#results_decompress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 68 | return false; 69 | }); 70 | $("#decompress_json_data_2_button").click(function(event) 71 | { 72 | var oComp = JSONC.compress( obj2 ); 73 | var stringCompressedJSON = JSON.stringify( JSONC.decompress( oComp ) ); 74 | $("#results_decompress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 75 | return false; 76 | }); 77 | 78 | $("#clean_unpack_json_data_button").click(function() 79 | { 80 | $("#results_unpack_json_data").html(""); 81 | return false; 82 | }); 83 | $("#unpack_json_data_1_button").click(function(event) 84 | { 85 | var gzipped = JSONC.pack( obj ); 86 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped ) ); 87 | $("#results_unpack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 88 | return false; 89 | }); 90 | $("#unpack_json_data_2_button").click(function(event) 91 | { 92 | var gzipped = JSONC.pack( obj2 ); 93 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped ) ); 94 | $("#results_unpack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 95 | return false; 96 | }); 97 | 98 | 99 | $("#clean_unpack_compress_json_data_button").click(function() 100 | { 101 | $("#results_unpack_compressed_json_data").html(""); 102 | return false; 103 | }); 104 | $("#unpack_compress_json_data_1_button").click(function(event) 105 | { 106 | var gzipped = JSONC.pack( obj, true ); 107 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped, true ) ); 108 | $("#results_unpack_compressed_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 109 | return false; 110 | }); 111 | $("#unpack_compress_json_data_2_button").click(function(event) 112 | { 113 | var gzipped = JSONC.pack( obj2, true ); 114 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped, true ) ); 115 | $("#results_unpack_compressed_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 116 | return false; 117 | }); 118 | }); 119 | $("form").submit(function(event) 120 | { 121 | var sObj, nLenObjStr, sZipped, nLenZipped; 122 | sObj = JSON.stringify( obj2 ); 123 | nLenObjStr = sObj.length; 124 | sZipped = JSONC.pack( obj2, true ); 125 | //sZipped = JSONC.pack( obj, true ); //version compact 126 | nLenZipped = sZipped.length; 127 | 128 | console.log( 'Original:', sObj, sObj.length ); 129 | console.log( 'Send:', sZipped, sZipped.length ); 130 | $.ajax({ 131 | url: "/obj2/demo_pack_gzip_compress_with_base64/alo.php", 132 | type: "POST", 133 | data: { json: nLenObjStr > nLenZipped ? sZipped : sObj }, 134 | dataType: 'json', 135 | success: function( data ) 136 | { 137 | document.getElementById('info_server').innerHTML = 'Press F12 to open developer tools and check the console tab'; 138 | data = JSONC.decompress( data ); //version compact 139 | console.log('Data:', data, JSON.stringify(data).length); 140 | }, 141 | error: function() 142 | { 143 | console.log.apply(console, arguments); 144 | } 145 | }); 146 | event.preventDefault(); 147 | }); -------------------------------------------------------------------------------- /Benchmark/obj2/demo_pack_gzip_compress_without_base64/js/app.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | $( "#accordion_data, #accordion_usage, #accordion_server" ).accordion( { active: false, collapsible: true } ); 3 | $("#clean_compress_json_data_button").click(function() 4 | { 5 | $("#results_compress_json_data").html(""); 6 | return false; 7 | }); 8 | $("#compress_json_data_1_button").click(function(event) 9 | { 10 | var compressedJSON = JSONC.compress( obj ); 11 | var stringCompressedJSON = JSON.stringify(compressedJSON); 12 | $("#results_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 13 | return false; 14 | }); 15 | $("#compress_json_data_2_button").click(function(event) 16 | { 17 | var compressedJSON = JSONC.compress( obj2 ); 18 | var stringCompressedJSON = JSON.stringify(compressedJSON); 19 | $("#results_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 20 | return false; 21 | }); 22 | $("#clean_pack_json_data_button").click(function() 23 | { 24 | $("#results_pack_json_data").html(""); 25 | return false; 26 | }); 27 | $("#pack_json_data_1_button").click(function(event) 28 | { 29 | var stringCompressedJSON = JSONC.pack( obj ); 30 | $("#results_pack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 31 | return false; 32 | }); 33 | $("#pack_json_data_2_button").click(function(event) 34 | { 35 | var stringCompressedJSON = JSONC.pack( obj2 ); 36 | $("#results_pack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 37 | return false; 38 | }); 39 | 40 | $("#clean_pack_compress_json_data_button").click(function() 41 | { 42 | $("#results_pack_compress_json_data").html(""); 43 | return false; 44 | }); 45 | $("#pack_compress_json_data_1_button").click(function(event) 46 | { 47 | var stringCompressedJSON = JSONC.pack( obj, true ); 48 | $("#results_pack_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 49 | return false; 50 | }); 51 | $("#pack_compress_json_data_2_button").click(function(event) 52 | { 53 | var stringCompressedJSON = JSONC.pack( obj2, true ); 54 | $("#results_pack_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 55 | return false; 56 | }); 57 | 58 | $("#clean_decompress_json_data_button").click(function() 59 | { 60 | $("#results_decompress_json_data").html(""); 61 | return false; 62 | }); 63 | $("#decompress_json_data_1_button").click(function(event) 64 | { 65 | var oComp = JSONC.compress( obj ); 66 | var stringCompressedJSON = JSON.stringify( JSONC.decompress( oComp ) ); 67 | $("#results_decompress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 68 | return false; 69 | }); 70 | $("#decompress_json_data_2_button").click(function(event) 71 | { 72 | var oComp = JSONC.compress( obj2 ); 73 | var stringCompressedJSON = JSON.stringify( JSONC.decompress( oComp ) ); 74 | $("#results_decompress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 75 | return false; 76 | }); 77 | 78 | $("#clean_unpack_json_data_button").click(function() 79 | { 80 | $("#results_unpack_json_data").html(""); 81 | return false; 82 | }); 83 | $("#unpack_json_data_1_button").click(function(event) 84 | { 85 | var gzipped = JSONC.pack( obj ); 86 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped ) ); 87 | $("#results_unpack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 88 | return false; 89 | }); 90 | $("#unpack_json_data_2_button").click(function(event) 91 | { 92 | var gzipped = JSONC.pack( obj2 ); 93 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped ) ); 94 | $("#results_unpack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 95 | return false; 96 | }); 97 | 98 | 99 | $("#clean_unpack_compress_json_data_button").click(function() 100 | { 101 | $("#results_unpack_compressed_json_data").html(""); 102 | return false; 103 | }); 104 | $("#unpack_compress_json_data_1_button").click(function(event) 105 | { 106 | var gzipped = JSONC.pack( obj, true ); 107 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped, true ) ); 108 | $("#results_unpack_compressed_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 109 | return false; 110 | }); 111 | $("#unpack_compress_json_data_2_button").click(function(event) 112 | { 113 | var gzipped = JSONC.pack( obj2, true ); 114 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped, true ) ); 115 | $("#results_unpack_compressed_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 116 | return false; 117 | }); 118 | }); 119 | $("form").submit(function(event) 120 | { 121 | var sObj, nLenObjStr, sZipped, nLenZipped; 122 | sObj = JSON.stringify( obj2 ); 123 | nLenObjStr = sObj.length; 124 | sZipped = JSONC.pack( obj2, true ); 125 | //sZipped = JSONC.pack( obj, true ); //version compact 126 | nLenZipped = sZipped.length; 127 | 128 | console.log( 'Original:', sObj, sObj.length ); 129 | console.log( 'Send:', sZipped, sZipped.length ); 130 | $.ajax({ 131 | url: "/obj2/demo_pack_gzip_compress_without_base64/alo.php", 132 | type: "POST", 133 | data: { json: nLenObjStr > nLenZipped ? sZipped : sObj }, 134 | dataType: 'json', 135 | success: function( data ) 136 | { 137 | document.getElementById('info_server').innerHTML = 'Press F12 to open developer tools and check the console tab'; 138 | data = JSONC.decompress( data ); //version compact 139 | console.log('Data:', data, JSON.stringify(data).length); 140 | }, 141 | error: function() 142 | { 143 | console.log.apply(console, arguments); 144 | } 145 | }); 146 | event.preventDefault(); 147 | }); -------------------------------------------------------------------------------- /Benchmark/obj2/demo_simple_json_stringify/js/app.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | $( "#accordion_data, #accordion_usage, #accordion_server" ).accordion( { active: false, collapsible: true } ); 3 | $("#clean_compress_json_data_button").click(function() 4 | { 5 | $("#results_compress_json_data").html(""); 6 | return false; 7 | }); 8 | $("#compress_json_data_1_button").click(function(event) 9 | { 10 | var compressedJSON = JSONC.compress( obj ); 11 | var stringCompressedJSON = JSON.stringify(compressedJSON); 12 | $("#results_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 13 | return false; 14 | }); 15 | $("#compress_json_data_2_button").click(function(event) 16 | { 17 | var compressedJSON = JSONC.compress( obj2 ); 18 | var stringCompressedJSON = JSON.stringify(compressedJSON); 19 | $("#results_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 20 | return false; 21 | }); 22 | $("#clean_pack_json_data_button").click(function() 23 | { 24 | $("#results_pack_json_data").html(""); 25 | return false; 26 | }); 27 | $("#pack_json_data_1_button").click(function(event) 28 | { 29 | var stringCompressedJSON = JSONC.pack( obj ); 30 | $("#results_pack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 31 | return false; 32 | }); 33 | $("#pack_json_data_2_button").click(function(event) 34 | { 35 | var stringCompressedJSON = JSONC.pack( obj2 ); 36 | $("#results_pack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 37 | return false; 38 | }); 39 | 40 | $("#clean_pack_compress_json_data_button").click(function() 41 | { 42 | $("#results_pack_compress_json_data").html(""); 43 | return false; 44 | }); 45 | $("#pack_compress_json_data_1_button").click(function(event) 46 | { 47 | var stringCompressedJSON = JSONC.pack( obj, true ); 48 | $("#results_pack_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 49 | return false; 50 | }); 51 | $("#pack_compress_json_data_2_button").click(function(event) 52 | { 53 | var stringCompressedJSON = JSONC.pack( obj2, true ); 54 | $("#results_pack_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 55 | return false; 56 | }); 57 | 58 | $("#clean_decompress_json_data_button").click(function() 59 | { 60 | $("#results_decompress_json_data").html(""); 61 | return false; 62 | }); 63 | $("#decompress_json_data_1_button").click(function(event) 64 | { 65 | var oComp = JSONC.compress( obj ); 66 | var stringCompressedJSON = JSON.stringify( JSONC.decompress( oComp ) ); 67 | $("#results_decompress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 68 | return false; 69 | }); 70 | $("#decompress_json_data_2_button").click(function(event) 71 | { 72 | var oComp = JSONC.compress( obj2 ); 73 | var stringCompressedJSON = JSON.stringify( JSONC.decompress( oComp ) ); 74 | $("#results_decompress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 75 | return false; 76 | }); 77 | 78 | $("#clean_unpack_json_data_button").click(function() 79 | { 80 | $("#results_unpack_json_data").html(""); 81 | return false; 82 | }); 83 | $("#unpack_json_data_1_button").click(function(event) 84 | { 85 | var gzipped = JSONC.pack( obj ); 86 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped ) ); 87 | $("#results_unpack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 88 | return false; 89 | }); 90 | $("#unpack_json_data_2_button").click(function(event) 91 | { 92 | var gzipped = JSONC.pack( obj2 ); 93 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped ) ); 94 | $("#results_unpack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 95 | return false; 96 | }); 97 | 98 | 99 | $("#clean_unpack_compress_json_data_button").click(function() 100 | { 101 | $("#results_unpack_compressed_json_data").html(""); 102 | return false; 103 | }); 104 | $("#unpack_compress_json_data_1_button").click(function(event) 105 | { 106 | var gzipped = JSONC.pack( obj, true ); 107 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped, true ) ); 108 | $("#results_unpack_compressed_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 109 | return false; 110 | }); 111 | $("#unpack_compress_json_data_2_button").click(function(event) 112 | { 113 | var gzipped = JSONC.pack( obj2, true ); 114 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped, true ) ); 115 | $("#results_unpack_compressed_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 116 | return false; 117 | }); 118 | }); 119 | $("form").submit(function(event) 120 | { 121 | var sObj, nLenObjStr, sZipped, nLenZipped; 122 | sObj = JSON.stringify( obj ); 123 | nLenObjStr = sObj.length; 124 | sZipped = JSONC.pack( obj ); 125 | //sZipped = JSONC.pack( obj, true ); //version compact 126 | nLenZipped = sZipped.length; 127 | 128 | console.log( 'Original:', sObj, sObj.length ); 129 | console.log( 'Send:', sZipped, sZipped.length ); 130 | $.ajax({ 131 | url: "/obj2/demo_simple_json_stringify/alo.php", 132 | type: "POST", 133 | data: { json: JSON.stringify( obj2 ) },//nLenObjStr > nLenZipped ? sZipped : sObj }, 134 | dataType: 'json', 135 | success: function( data ) 136 | { 137 | document.getElementById('info_server').innerHTML = 'Press F12 to open developer tools and check the console tab'; 138 | //data = JSONC.decompress( data ); //version compact 139 | console.log('Data:', data, JSON.stringify(data).length); 140 | }, 141 | error: function() 142 | { 143 | console.log.apply(console, arguments); 144 | } 145 | }); 146 | event.preventDefault(); 147 | }); -------------------------------------------------------------------------------- /Benchmark/obj/demo_simple_json_stringify_with_base64/js/app.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | $( "#accordion_data, #accordion_usage, #accordion_server" ).accordion( { active: false, collapsible: true } ); 3 | $("#clean_compress_json_data_button").click(function() 4 | { 5 | $("#results_compress_json_data").html(""); 6 | return false; 7 | }); 8 | $("#compress_json_data_1_button").click(function(event) 9 | { 10 | var compressedJSON = JSONC.compress( obj ); 11 | var stringCompressedJSON = JSON.stringify(compressedJSON); 12 | $("#results_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 13 | return false; 14 | }); 15 | $("#compress_json_data_2_button").click(function(event) 16 | { 17 | var compressedJSON = JSONC.compress( obj2 ); 18 | var stringCompressedJSON = JSON.stringify(compressedJSON); 19 | $("#results_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 20 | return false; 21 | }); 22 | $("#clean_pack_json_data_button").click(function() 23 | { 24 | $("#results_pack_json_data").html(""); 25 | return false; 26 | }); 27 | $("#pack_json_data_1_button").click(function(event) 28 | { 29 | var stringCompressedJSON = JSONC.pack( obj ); 30 | $("#results_pack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 31 | return false; 32 | }); 33 | $("#pack_json_data_2_button").click(function(event) 34 | { 35 | var stringCompressedJSON = JSONC.pack( obj2 ); 36 | $("#results_pack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 37 | return false; 38 | }); 39 | 40 | $("#clean_pack_compress_json_data_button").click(function() 41 | { 42 | $("#results_pack_compress_json_data").html(""); 43 | return false; 44 | }); 45 | $("#pack_compress_json_data_1_button").click(function(event) 46 | { 47 | var stringCompressedJSON = JSONC.pack( obj, true ); 48 | $("#results_pack_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 49 | return false; 50 | }); 51 | $("#pack_compress_json_data_2_button").click(function(event) 52 | { 53 | var stringCompressedJSON = JSONC.pack( obj2, true ); 54 | $("#results_pack_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 55 | return false; 56 | }); 57 | 58 | $("#clean_decompress_json_data_button").click(function() 59 | { 60 | $("#results_decompress_json_data").html(""); 61 | return false; 62 | }); 63 | $("#decompress_json_data_1_button").click(function(event) 64 | { 65 | var oComp = JSONC.compress( obj ); 66 | var stringCompressedJSON = JSON.stringify( JSONC.decompress( oComp ) ); 67 | $("#results_decompress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 68 | return false; 69 | }); 70 | $("#decompress_json_data_2_button").click(function(event) 71 | { 72 | var oComp = JSONC.compress( obj2 ); 73 | var stringCompressedJSON = JSON.stringify( JSONC.decompress( oComp ) ); 74 | $("#results_decompress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 75 | return false; 76 | }); 77 | 78 | $("#clean_unpack_json_data_button").click(function() 79 | { 80 | $("#results_unpack_json_data").html(""); 81 | return false; 82 | }); 83 | $("#unpack_json_data_1_button").click(function(event) 84 | { 85 | var gzipped = JSONC.pack( obj ); 86 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped ) ); 87 | $("#results_unpack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 88 | return false; 89 | }); 90 | $("#unpack_json_data_2_button").click(function(event) 91 | { 92 | var gzipped = JSONC.pack( obj2 ); 93 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped ) ); 94 | $("#results_unpack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 95 | return false; 96 | }); 97 | 98 | 99 | $("#clean_unpack_compress_json_data_button").click(function() 100 | { 101 | $("#results_unpack_compressed_json_data").html(""); 102 | return false; 103 | }); 104 | $("#unpack_compress_json_data_1_button").click(function(event) 105 | { 106 | var gzipped = JSONC.pack( obj, true ); 107 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped, true ) ); 108 | $("#results_unpack_compressed_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 109 | return false; 110 | }); 111 | $("#unpack_compress_json_data_2_button").click(function(event) 112 | { 113 | var gzipped = JSONC.pack( obj2, true ); 114 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped, true ) ); 115 | $("#results_unpack_compressed_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 116 | return false; 117 | }); 118 | }); 119 | $("form").submit(function(event) 120 | { 121 | var sObj, nLenObjStr, sZipped, nLenZipped; 122 | sObj = JSON.stringify( obj ); 123 | nLenObjStr = sObj.length; 124 | sZipped = JSONC.pack( obj, true ); 125 | //sZipped = JSONC.pack( obj, true ); //version compact 126 | nLenZipped = sZipped.length; 127 | 128 | console.log( 'Original:', sObj, sObj.length ); 129 | console.log( 'Send:', sZipped, sZipped.length ); 130 | $.ajax({ 131 | url: "/obj/demo_simple_json_stringify_with_base64/alo.php", 132 | type: "POST", 133 | data: { json: Base64.encode(sObj) },//nLenObjStr > nLenZipped ? sZipped : sObj }, 134 | dataType: 'json', 135 | success: function( data ) 136 | { 137 | document.getElementById('info_server').innerHTML = 'Press F12 to open developer tools and check the console tab'; 138 | data = JSONC.decompress( data ); //version compact 139 | console.log('Data:', data, JSON.stringify(data).length); 140 | }, 141 | error: function() 142 | { 143 | console.log.apply(console, arguments); 144 | } 145 | }); 146 | event.preventDefault(); 147 | }); -------------------------------------------------------------------------------- /Benchmark/obj2/demo_simple_json_stringify_with_base64/js/app.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | $( "#accordion_data, #accordion_usage, #accordion_server" ).accordion( { active: false, collapsible: true } ); 3 | $("#clean_compress_json_data_button").click(function() 4 | { 5 | $("#results_compress_json_data").html(""); 6 | return false; 7 | }); 8 | $("#compress_json_data_1_button").click(function(event) 9 | { 10 | var compressedJSON = JSONC.compress( obj ); 11 | var stringCompressedJSON = JSON.stringify(compressedJSON); 12 | $("#results_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 13 | return false; 14 | }); 15 | $("#compress_json_data_2_button").click(function(event) 16 | { 17 | var compressedJSON = JSONC.compress( obj2 ); 18 | var stringCompressedJSON = JSON.stringify(compressedJSON); 19 | $("#results_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 20 | return false; 21 | }); 22 | $("#clean_pack_json_data_button").click(function() 23 | { 24 | $("#results_pack_json_data").html(""); 25 | return false; 26 | }); 27 | $("#pack_json_data_1_button").click(function(event) 28 | { 29 | var stringCompressedJSON = JSONC.pack( obj ); 30 | $("#results_pack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 31 | return false; 32 | }); 33 | $("#pack_json_data_2_button").click(function(event) 34 | { 35 | var stringCompressedJSON = JSONC.pack( obj2 ); 36 | $("#results_pack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 37 | return false; 38 | }); 39 | 40 | $("#clean_pack_compress_json_data_button").click(function() 41 | { 42 | $("#results_pack_compress_json_data").html(""); 43 | return false; 44 | }); 45 | $("#pack_compress_json_data_1_button").click(function(event) 46 | { 47 | var stringCompressedJSON = JSONC.pack( obj, true ); 48 | $("#results_pack_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 49 | return false; 50 | }); 51 | $("#pack_compress_json_data_2_button").click(function(event) 52 | { 53 | var stringCompressedJSON = JSONC.pack( obj2, true ); 54 | $("#results_pack_compress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 55 | return false; 56 | }); 57 | 58 | $("#clean_decompress_json_data_button").click(function() 59 | { 60 | $("#results_decompress_json_data").html(""); 61 | return false; 62 | }); 63 | $("#decompress_json_data_1_button").click(function(event) 64 | { 65 | var oComp = JSONC.compress( obj ); 66 | var stringCompressedJSON = JSON.stringify( JSONC.decompress( oComp ) ); 67 | $("#results_decompress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 68 | return false; 69 | }); 70 | $("#decompress_json_data_2_button").click(function(event) 71 | { 72 | var oComp = JSONC.compress( obj2 ); 73 | var stringCompressedJSON = JSON.stringify( JSONC.decompress( oComp ) ); 74 | $("#results_decompress_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 75 | return false; 76 | }); 77 | 78 | $("#clean_unpack_json_data_button").click(function() 79 | { 80 | $("#results_unpack_json_data").html(""); 81 | return false; 82 | }); 83 | $("#unpack_json_data_1_button").click(function(event) 84 | { 85 | var gzipped = JSONC.pack( obj ); 86 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped ) ); 87 | $("#results_unpack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 88 | return false; 89 | }); 90 | $("#unpack_json_data_2_button").click(function(event) 91 | { 92 | var gzipped = JSONC.pack( obj2 ); 93 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped ) ); 94 | $("#results_unpack_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 95 | return false; 96 | }); 97 | 98 | 99 | $("#clean_unpack_compress_json_data_button").click(function() 100 | { 101 | $("#results_unpack_compressed_json_data").html(""); 102 | return false; 103 | }); 104 | $("#unpack_compress_json_data_1_button").click(function(event) 105 | { 106 | var gzipped = JSONC.pack( obj, true ); 107 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped, true ) ); 108 | $("#results_unpack_compressed_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
"); 109 | return false; 110 | }); 111 | $("#unpack_compress_json_data_2_button").click(function(event) 112 | { 113 | var gzipped = JSONC.pack( obj2, true ); 114 | var stringCompressedJSON = JSON.stringify( JSONC.unpack( gzipped, true ) ); 115 | $("#results_unpack_compressed_json_data").html( "
" + stringCompressedJSON.length + " bytes.
" + stringCompressedJSON + "
" ); 116 | return false; 117 | }); 118 | }); 119 | $("form").submit(function(event) 120 | { 121 | var sObj, nLenObjStr, sZipped, nLenZipped; 122 | sObj = JSON.stringify( obj2 ); 123 | nLenObjStr = sObj.length; 124 | sZipped = JSONC.pack( obj2, true ); 125 | //sZipped = JSONC.pack( obj, true ); //version compact 126 | nLenZipped = sZipped.length; 127 | 128 | console.log( 'Original:', sObj, sObj.length ); 129 | console.log( 'Send:', sZipped, sZipped.length ); 130 | $.ajax({ 131 | url: "/obj2/demo_simple_json_stringify_with_base64/alo.php", 132 | type: "POST", 133 | data: { json: Base64.encode(sObj) },//nLenObjStr > nLenZipped ? sZipped : sObj }, 134 | dataType: 'json', 135 | success: function( data ) 136 | { 137 | document.getElementById('info_server').innerHTML = 'Press F12 to open developer tools and check the console tab'; 138 | data = JSONC.decompress( data ); //version compact 139 | console.log('Data:', data, JSON.stringify(data).length); 140 | }, 141 | error: function() 142 | { 143 | console.log.apply(console, arguments); 144 | } 145 | }); 146 | event.preventDefault(); 147 | }); -------------------------------------------------------------------------------- /vendor/gzip.js: -------------------------------------------------------------------------------- 1 | (function (global) { 2 | 'use strict'; 3 | 4 | var crc32 = global.crc32, 5 | deflate = global.deflate, 6 | // magic numbers marking this file as GZIP 7 | ID1 = 0x1F, 8 | ID2 = 0x8B, 9 | compressionMethods = { 10 | 'deflate': 8 11 | }, 12 | possibleFlags = { 13 | 'FTEXT': 0x01, 14 | 'FHCRC': 0x02, 15 | 'FEXTRA': 0x04, 16 | 'FNAME': 0x08, 17 | 'FCOMMENT': 0x10 18 | }, 19 | osMap = { 20 | 'fat': 0, // FAT file system (DOS, OS/2, NT) + PKZIPW 2.50 VFAT, NTFS 21 | 'amiga': 1, // Amiga 22 | 'vmz': 2, // VMS (VAX or Alpha AXP) 23 | 'unix': 3, // Unix 24 | 'vm/cms': 4, // VM/CMS 25 | 'atari': 5, // Atari 26 | 'hpfs': 6, // HPFS file system (OS/2, NT 3.x) 27 | 'macintosh': 7, // Macintosh 28 | 'z-system': 8, // Z-System 29 | 'cplm': 9, // CP/M 30 | 'tops-20': 10, // TOPS-20 31 | 'ntfs': 11, // NTFS file system (NT) 32 | 'qdos': 12, // SMS/QDOS 33 | 'acorn': 13, // Acorn RISC OS 34 | 'vfat': 14, // VFAT file system (Win95, NT) 35 | 'vms': 15, // MVS (code also taken for PRIMOS) 36 | 'beos': 16, // BeOS (BeBox or PowerMac) 37 | 'tandem': 17, // Tandem/NSK 38 | 'theos': 18 // THEOS 39 | }, 40 | os = 'unix', 41 | DEFAULT_LEVEL = 6; 42 | 43 | function putByte(n, arr) { 44 | arr.push(n & 0xFF); 45 | } 46 | 47 | // LSB first 48 | function putShort(n, arr) { 49 | arr.push(n & 0xFF); 50 | arr.push(n >>> 8); 51 | } 52 | 53 | // LSB first 54 | function putLong(n, arr) { 55 | putShort(n & 0xffff, arr); 56 | putShort(n >>> 16, arr); 57 | } 58 | 59 | function putString(s, arr) { 60 | var i, len = s.length; 61 | for (i = 0; i < len; i += 1) { 62 | putByte(s.charCodeAt(i), arr); 63 | } 64 | } 65 | 66 | function readByte(arr) { 67 | return arr.shift(); 68 | } 69 | 70 | function readShort(arr) { 71 | return arr.shift() | (arr.shift() << 8); 72 | } 73 | 74 | function readLong(arr) { 75 | var n1 = readShort(arr), 76 | n2 = readShort(arr); 77 | 78 | // JavaScript can't handle bits in the position 32 79 | // we'll emulate this by removing the left-most bit (if it exists) 80 | // and add it back in via multiplication, which does work 81 | if (n2 > 32768) { 82 | n2 -= 32768; 83 | 84 | return ((n2 << 16) | n1) + 32768 * Math.pow(2, 16); 85 | } 86 | 87 | return (n2 << 16) | n1; 88 | } 89 | 90 | function readString(arr) { 91 | var charArr = []; 92 | 93 | // turn all bytes into chars until the terminating null 94 | while (arr[0] !== 0) { 95 | charArr.push(String.fromCharCode(arr.shift())); 96 | } 97 | 98 | // throw away terminating null 99 | arr.shift(); 100 | 101 | // join all characters into a cohesive string 102 | return charArr.join(''); 103 | } 104 | 105 | /* 106 | * Reads n number of bytes and return as an array. 107 | * 108 | * @param arr- Array of bytes to read from 109 | * @param n- Number of bytes to read 110 | */ 111 | function readBytes(arr, n) { 112 | var i, ret = []; 113 | for (i = 0; i < n; i += 1) { 114 | ret.push(arr.shift()); 115 | } 116 | 117 | return ret; 118 | } 119 | 120 | /* 121 | * ZIPs a file in GZIP format. The format is as given by the spec, found at: 122 | * http://www.gzip.org/zlib/rfc-gzip.html 123 | * 124 | * Omitted parts in this implementation: 125 | */ 126 | function zip(data, options) { 127 | var flags = 0, 128 | level, 129 | crc, out = []; 130 | 131 | if (!options) { 132 | options = {}; 133 | } 134 | level = options.level || DEFAULT_LEVEL; 135 | 136 | if (typeof data === 'string') { 137 | data = Array.prototype.map.call(data, function (char) { 138 | return char.charCodeAt(0); 139 | }); 140 | } 141 | 142 | // magic number marking this file as GZIP 143 | putByte(ID1, out); 144 | putByte(ID2, out); 145 | 146 | putByte(compressionMethods['deflate'], out); 147 | 148 | if (options.name) { 149 | flags |= possibleFlags['FNAME']; 150 | } 151 | 152 | putByte(flags, out); 153 | putLong(options.timestamp || parseInt(Date.now() / 1000, 10), out); 154 | 155 | // put deflate args (extra flags) 156 | if (level === 1) { 157 | // fastest algorithm 158 | putByte(4, out); 159 | } else if (level === 9) { 160 | // maximum compression (fastest algorithm) 161 | putByte(2, out); 162 | } else { 163 | putByte(0, out); 164 | } 165 | 166 | // OS identifier 167 | putByte(osMap[os], out); 168 | 169 | if (options.name) { 170 | // ignore the directory part 171 | putString(options.name.substring(options.name.lastIndexOf('/') + 1), out); 172 | 173 | // terminating null 174 | putByte(0, out); 175 | } 176 | 177 | deflate.deflate(data, level).forEach(function (byte) { 178 | putByte(byte, out); 179 | }); 180 | 181 | putLong(parseInt(crc32(data), 16), out); 182 | putLong(data.length, out); 183 | 184 | return out; 185 | } 186 | 187 | function unzip(data, options) { 188 | // start with a copy of the array 189 | var arr = Array.prototype.slice.call(data, 0), 190 | t, 191 | compressionMethod, 192 | flags, 193 | mtime, 194 | xFlags, 195 | key, 196 | os, 197 | crc, 198 | size, 199 | res; 200 | 201 | // check the first two bytes for the magic numbers 202 | if (readByte(arr) !== ID1 || readByte(arr) !== ID2) { 203 | throw 'Not a GZIP file'; 204 | } 205 | 206 | t = readByte(arr); 207 | t = Object.keys(compressionMethods).some(function (key) { 208 | compressionMethod = key; 209 | return compressionMethods[key] === t; 210 | }); 211 | 212 | if (!t) { 213 | throw 'Unsupported compression method'; 214 | } 215 | 216 | flags = readByte(arr); 217 | mtime = readLong(arr); 218 | xFlags = readByte(arr); 219 | t = readByte(arr); 220 | Object.keys(osMap).some(function (key) { 221 | if (osMap[key] === t) { 222 | os = key; 223 | return true; 224 | } 225 | }); 226 | 227 | // just throw away the bytes for now 228 | if (flags & possibleFlags['FEXTRA']) { 229 | t = readShort(arr); 230 | readBytes(arr, t); 231 | } 232 | 233 | // just throw away for now 234 | if (flags & possibleFlags['FNAME']) { 235 | readString(arr); 236 | } 237 | 238 | // just throw away for now 239 | if (flags & possibleFlags['FCOMMENT']) { 240 | readString(arr); 241 | } 242 | 243 | // just throw away for now 244 | if (flags & possibleFlags['FHCRC']) { 245 | readShort(arr); 246 | } 247 | 248 | if (compressionMethod === 'deflate') { 249 | // give deflate everything but the last 8 bytes 250 | // the last 8 bytes are for the CRC32 checksum and filesize 251 | res = deflate.inflate(arr.splice(0, arr.length - 8)); 252 | } 253 | 254 | if (flags & possibleFlags['FTEXT']) { 255 | res = Array.prototype.map.call(res, function (byte) { 256 | return String.fromCharCode(byte); 257 | }).join(''); 258 | } 259 | 260 | crc = readLong(arr); 261 | if (crc !== parseInt(crc32(res), 16)) { 262 | throw 'Checksum does not match'; 263 | } 264 | 265 | size = readLong(arr); 266 | if (size !== res.length) { 267 | throw 'Size of decompressed file not correct'; 268 | } 269 | 270 | return res; 271 | } 272 | 273 | global.gzip = { 274 | zip: zip, 275 | unzip: unzip, 276 | get DEFAULT_LEVEL() { 277 | return DEFAULT_LEVEL; 278 | } 279 | } 280 | }(this)); 281 | -------------------------------------------------------------------------------- /src/JSONC.js: -------------------------------------------------------------------------------- 1 | /*global gzip, Base64*/ 2 | (function () { 3 | 4 | var root, 5 | JSONC = {}, 6 | isNodeEnvironment, 7 | _nCode = -1, 8 | toString = {}.toString; 9 | 10 | /** 11 | * set the correct root depending from the environment. 12 | * @type {Object} 13 | * @private 14 | */ 15 | root = this; 16 | /** 17 | * Check if JSONC is loaded in Node.js environment 18 | * @type {Boolean} 19 | * @private 20 | */ 21 | isNodeEnvironment = typeof exports === 'object' && typeof module === 'object' && typeof module.exports === 'object' && typeof require === 'function'; 22 | /** 23 | * Checks if the value exist in the array. 24 | * @param arr 25 | * @param v 26 | * @returns {boolean} 27 | */ 28 | function contains(arr, v) { 29 | var nIndex, 30 | nLen = arr.length; 31 | for (nIndex = 0; nIndex < nLen; nIndex++) { 32 | if (arr[nIndex][1] === v) { 33 | return true; 34 | } 35 | } 36 | return false; 37 | } 38 | 39 | /** 40 | * Removes duplicated values in an array 41 | * @param oldArray 42 | * @returns {Array} 43 | */ 44 | function unique(oldArray) { 45 | var nIndex, 46 | nLen = oldArray.length, 47 | aArr = []; 48 | for (nIndex = 0; nIndex < nLen; nIndex++) { 49 | if (!contains(aArr, oldArray[nIndex][1])) { 50 | aArr.push(oldArray[nIndex]); 51 | } 52 | } 53 | return aArr; 54 | } 55 | 56 | /** 57 | * Escapes a RegExp 58 | * @param text 59 | * @returns {*} 60 | */ 61 | function escapeRegExp(text) { 62 | return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); 63 | } 64 | 65 | /** 66 | * Returns if the obj is an object or not. 67 | * @param obj 68 | * @returns {boolean} 69 | * @private 70 | */ 71 | function _isObject(obj) { 72 | return toString.call(obj) === '[object Object]'; 73 | } 74 | 75 | /** 76 | * Returns if the obj is an array or not 77 | * @param obj 78 | * @returns {boolean} 79 | * @private 80 | */ 81 | function _isArray(obj) { 82 | return toString.call(obj) === '[object Array]'; 83 | } 84 | 85 | /** 86 | * Converts a bidimensional array to object 87 | * @param aArr 88 | * @returns {{}} 89 | * @private 90 | */ 91 | function _biDimensionalArrayToObject(aArr) { 92 | var obj = {}, 93 | nIndex, 94 | nLen = aArr.length, 95 | oItem; 96 | for (nIndex = 0; nIndex < nLen; nIndex++) { 97 | oItem = aArr[nIndex]; 98 | obj[oItem[0]] = oItem[1]; 99 | } 100 | return obj; 101 | } 102 | 103 | /** 104 | * Convert a number to their ascii code/s. 105 | * @param index 106 | * @param totalChar 107 | * @param offset 108 | * @returns {Array} 109 | * @private 110 | */ 111 | function _numberToKey(index, totalChar, offset) { 112 | var sKeys = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=_!?()*', 113 | aArr = [], 114 | currentChar = index; 115 | totalChar = totalChar || sKeys.length; 116 | offset = offset || 0; 117 | while (currentChar >= totalChar) { 118 | aArr.push(sKeys.charCodeAt((currentChar % totalChar) + offset)); 119 | currentChar = Math.floor(currentChar / totalChar - 1); 120 | } 121 | aArr.push(sKeys.charCodeAt(currentChar + offset)); 122 | return aArr.reverse(); 123 | } 124 | 125 | /** 126 | * Returns the string using an array of ASCII values 127 | * @param aKeys 128 | * @returns {string} 129 | * @private 130 | */ 131 | function _getSpecialKey(aKeys) { 132 | return String.fromCharCode.apply(String, aKeys); 133 | } 134 | 135 | /** 136 | * Traverse all the objects looking for keys and set an array with the new keys 137 | * @param json 138 | * @param aKeys 139 | * @returns {*} 140 | * @private 141 | */ 142 | function _getKeys(json, aKeys) { 143 | var aKey, 144 | sKey, 145 | oItem; 146 | 147 | for (sKey in json) { 148 | 149 | if (json.hasOwnProperty(sKey)) { 150 | oItem = json[sKey]; 151 | if (_isObject(oItem) || _isArray(oItem)) { 152 | aKeys = aKeys.concat(unique(_getKeys(oItem, aKeys))); 153 | } 154 | if (isNaN(Number(sKey))) { 155 | if (!contains(aKeys, sKey)) { 156 | _nCode += 1; 157 | aKey = []; 158 | aKey.push(_getSpecialKey(_numberToKey(_nCode)), sKey); 159 | aKeys.push(aKey); 160 | } 161 | } 162 | } 163 | } 164 | return aKeys; 165 | } 166 | 167 | /** 168 | * Method to compress array objects 169 | * @private 170 | * @param json 171 | * @param aKeys 172 | */ 173 | function _compressArray(json, aKeys) { 174 | var nIndex, 175 | nLenKeys; 176 | 177 | for (nIndex = 0, nLenKeys = json.length; nIndex < nLenKeys; nIndex++) { 178 | json[nIndex] = JSONC.compress(json[nIndex], aKeys); 179 | } 180 | } 181 | 182 | /** 183 | * Method to compress anything but array 184 | * @private 185 | * @param json 186 | * @param aKeys 187 | * @returns {*} 188 | */ 189 | function _compressOther(json, aKeys) { 190 | var oKeys, 191 | aKey, 192 | str, 193 | nLenKeys, 194 | nIndex, 195 | obj; 196 | aKeys = _getKeys(json, aKeys); 197 | aKeys = unique(aKeys); 198 | oKeys = _biDimensionalArrayToObject(aKeys); 199 | 200 | str = JSON.stringify(json); 201 | nLenKeys = aKeys.length; 202 | 203 | for (nIndex = 0; nIndex < nLenKeys; nIndex++) { 204 | aKey = aKeys[nIndex]; 205 | str = str.replace(new RegExp(escapeRegExp('"' + aKey[1] + '"'), 'g'), '"' + aKey[0] + '"'); 206 | } 207 | obj = JSON.parse(str); 208 | obj._ = oKeys; 209 | return obj; 210 | } 211 | 212 | /** 213 | * Method to decompress array objects 214 | * @private 215 | * @param json 216 | */ 217 | function _decompressArray(json) { 218 | var nIndex, nLenKeys; 219 | 220 | for (nIndex = 0, nLenKeys = json.length; nIndex < nLenKeys; nIndex++) { 221 | json[nIndex] = JSONC.decompress(json[nIndex]); 222 | } 223 | } 224 | 225 | /** 226 | * Method to decompress anything but array 227 | * @private 228 | * @param jsonCopy 229 | * @returns {*} 230 | */ 231 | function _decompressOther(jsonCopy) { 232 | var oKeys, str, sKey; 233 | 234 | oKeys = JSON.parse(JSON.stringify(jsonCopy._)); 235 | delete jsonCopy._; 236 | str = JSON.stringify(jsonCopy); 237 | for (sKey in oKeys) { 238 | if (oKeys.hasOwnProperty(sKey)) { 239 | str = str.replace(new RegExp('"' + sKey + '"', 'g'), '"' + oKeys[sKey] + '"'); 240 | } 241 | } 242 | return str; 243 | } 244 | 245 | /** 246 | * Compress a RAW JSON 247 | * @param json 248 | * @param optKeys 249 | * @returns {*} 250 | */ 251 | JSONC.compress = function (json, optKeys) { 252 | if (!optKeys) { 253 | _nCode = -1; 254 | } 255 | var aKeys = optKeys || [], 256 | obj; 257 | 258 | if (_isArray(json)) { 259 | _compressArray(json, aKeys); 260 | obj = json; 261 | } 262 | else { 263 | obj = _compressOther(json, aKeys); 264 | } 265 | return obj; 266 | }; 267 | /** 268 | * Use LZString to get the compressed string. 269 | * @param json 270 | * @param bCompress 271 | * @returns {String} 272 | */ 273 | JSONC.pack = function (json, bCompress) { 274 | var str = JSON.stringify((bCompress ? JSONC.compress(json) : json)); 275 | return Base64.encode(String.fromCharCode.apply(String, gzip.zip(str,{level:9}))); 276 | }; 277 | /** 278 | * Decompress a compressed JSON 279 | * @param json 280 | * @returns {*} 281 | */ 282 | JSONC.decompress = function (json) { 283 | var str, 284 | jsonCopy = JSON.parse(JSON.stringify(json)); 285 | if (_isArray(jsonCopy)) { 286 | _decompressArray(jsonCopy); 287 | } 288 | else { 289 | str = _decompressOther(jsonCopy); 290 | } 291 | return str ? JSON.parse(str) : jsonCopy; 292 | }; 293 | function getArr(str) { 294 | var nIndex = 0, 295 | nLen = str.length, 296 | arr = []; 297 | for (; nIndex < nLen; nIndex++) { 298 | arr.push(str.charCodeAt(nIndex)); 299 | } 300 | return arr; 301 | } 302 | 303 | /** 304 | * Returns the JSON object from the LZW string 305 | * @param gzipped 306 | * @param bDecompress 307 | * @returns {Object} 308 | */ 309 | JSONC.unpack = function (gzipped, bDecompress) { 310 | var aArr = getArr(Base64.decode(gzipped)), 311 | str = String.fromCharCode.apply(String, gzip.unzip(aArr,{level:9})), 312 | json = JSON.parse(str); 313 | return bDecompress ? JSONC.decompress(json) : json; 314 | }; 315 | /* 316 | * Expose Hydra to be used in node.js, as AMD module or as global 317 | */ 318 | root.JSONC = JSONC; 319 | if (isNodeEnvironment) { 320 | module.exports = JSONC; 321 | } 322 | else if (typeof define !== 'undefined') { 323 | define('jsoncomp', [], function () { 324 | return JSONC; 325 | }); 326 | } 327 | }.call(this)); -------------------------------------------------------------------------------- /test/JSONC.js: -------------------------------------------------------------------------------- 1 | function getArr(str) 2 | { 3 | var nIndex = 0, 4 | nLen = str.length, 5 | arr = []; 6 | for(; nIndex < nLen; nIndex++) 7 | { 8 | arr.push(str.charCodeAt(nIndex)); 9 | } 10 | return arr; 11 | } 12 | describe('JSONC API', function () 13 | { 14 | it('should check that JSONC exist in Namespace', function () 15 | { 16 | expect( JSONC ).not.toBeUndefined(); 17 | }); 18 | it('should check that JSONC has a compress method', function () 19 | { 20 | expect(typeof JSONC.compress === 'function').toBeTruthy(); 21 | }); 22 | it('should check that JSONC has a decompress method', function () 23 | { 24 | expect(typeof JSONC.decompress === 'function').toBeTruthy(); 25 | }); 26 | }); 27 | describe('JSONC.compress', function (){ 28 | it('should check that returns that we expected', function(){ 29 | var original = [{ 30 | 'test': 'result' 31 | }], 32 | expected = [{ 33 | _: {"A":'test'}, 34 | A: 'result' 35 | }], 36 | retrieved; 37 | 38 | retrieved = JSONC.compress( original ); 39 | 40 | expect(retrieved).toEqual(expected); 41 | }); 42 | it('should check that returns that we expected', function () 43 | { 44 | var original = { 45 | 'test': 'result' 46 | }, 47 | expected = { 48 | _: {"A":'test'}, 49 | A: 'result' 50 | }, 51 | retrieved; 52 | 53 | retrieved = JSONC.compress( original ); 54 | 55 | expect(retrieved).toEqual(expected); 56 | }); 57 | it('should check that returns that we expected', function () 58 | { 59 | var original = { 60 | 'test': 'result', 61 | 'test1': 'result', 62 | 'test2': 'result', 63 | 'test3': 'result', 64 | 'test4': 'result', 65 | 'test5': 'result', 66 | 'test6': 'result', 67 | 'test7': 'result', 68 | 'test8': 'result', 69 | 'test9': 'result', 70 | 'test10': 'result', 71 | 'test11': 'result', 72 | 'test12': 'result', 73 | 'test13': 'result', 74 | 'test14': 'result', 75 | 'test15': 'result', 76 | 'test16': 'result', 77 | 'test17': 'result', 78 | 'test18': 'result', 79 | 'test19': 'result', 80 | 'test20': 'result', 81 | 'test21': 'result', 82 | 'test22': 'result', 83 | 'test23': 'result', 84 | 'test24': 'result', 85 | 'test25': 'result', 86 | 'test26': 'result', 87 | 'test27': 'result' 88 | }, 89 | expected = { 90 | _: { 91 | "A":'test', 92 | "B":'test1', 93 | "C":'test2', 94 | "D":'test3', 95 | "E":'test4', 96 | "F":'test5', 97 | "G":'test6', 98 | "H":'test7', 99 | "I":'test8', 100 | "J":'test9', 101 | "K":'test10', 102 | "L":'test11', 103 | "M":'test12', 104 | "N":'test13', 105 | "O":'test14', 106 | "P":'test15', 107 | "Q":'test16', 108 | "R":'test17', 109 | "S":'test18', 110 | "T":'test19', 111 | "U":'test20', 112 | "V":'test21', 113 | "W":'test22', 114 | "X":'test23', 115 | "Y":'test24', 116 | "Z":'test25', 117 | "a":'test26', 118 | "b":'test27' 119 | }, 120 | "A":'result', 121 | "B":'result', 122 | "C":'result', 123 | "D":'result', 124 | "E":'result', 125 | "F":'result', 126 | "G":'result', 127 | "H":'result', 128 | "I":'result', 129 | "J":'result', 130 | "K":'result', 131 | "L":'result', 132 | "M":'result', 133 | "N":'result', 134 | "O":'result', 135 | "P":'result', 136 | "Q":'result', 137 | "R":'result', 138 | "S":'result', 139 | "T":'result', 140 | "U":'result', 141 | "V":'result', 142 | "W":'result', 143 | "X":'result', 144 | "Y":'result', 145 | "Z":'result', 146 | "a":'result', 147 | "b":'result' 148 | }, 149 | retrieved; 150 | 151 | retrieved = JSONC.compress( original ); 152 | 153 | expect(retrieved).toEqual(expected); 154 | }); 155 | it('should check that returns that we expected', function () 156 | { 157 | var original = { 158 | 'data': [ 159 | { 160 | 'test': 1, 161 | 'test2': [2,3], 162 | 'test3': 3 163 | }, 164 | { 165 | 'test': 4, 166 | 'test2': 5, 167 | 'test3': 6 168 | } 169 | ] 170 | }, 171 | expected = { 172 | _: {"A":'test', "B":'test2', "C":'test3', "D":'data'}, 173 | D: [ 174 | { 175 | 'A':1, 176 | 'B':[2,3], 177 | 'C':3 178 | }, 179 | { 180 | 'A':4, 181 | 'B':5, 182 | 'C':6 183 | } 184 | ] 185 | }, 186 | retrieved; 187 | 188 | retrieved = JSONC.compress( original ); 189 | 190 | expect(retrieved).toEqual(expected); 191 | }); 192 | }); 193 | describe('JSONC.decompress', function (){ 194 | it('should check that returns that we expected', function () 195 | { 196 | var expected = [{ 197 | 'test': 'result' 198 | }], 199 | original = [{ 200 | _: {"A":'test'}, 201 | A: 'result' 202 | }], 203 | retrieved; 204 | 205 | retrieved = JSONC.decompress( original ); 206 | 207 | expect(retrieved).toEqual(expected); 208 | }); 209 | it('should check that returns that we expected', function () 210 | { 211 | var expected = { 212 | 'test': 'result' 213 | }, 214 | original = { 215 | _: {"A":'test'}, 216 | A: 'result' 217 | }, 218 | retrieved; 219 | 220 | retrieved = JSONC.decompress( original ); 221 | 222 | expect(retrieved).toEqual(expected); 223 | }); 224 | it('should check that returns that we expected as array', function () 225 | { 226 | var expected = { 227 | 'data': [ 228 | { 229 | 'test': 1, 230 | 'test2': 2, 231 | 'test3': 3 232 | }, 233 | { 234 | 'test': 4, 235 | 'test2': 5, 236 | 'test3': 6 237 | } 238 | ] 239 | }, 240 | original = { 241 | _: {"A":'test', "B":'test2', "C":'test3', "D":'data'}, 242 | D: [ 243 | { 244 | 'A':1, 245 | 'B':2, 246 | 'C':3 247 | }, 248 | { 249 | 'A':4, 250 | 'B':5, 251 | 'C':6 252 | } 253 | ] 254 | }, 255 | retrieved; 256 | 257 | retrieved = JSONC.decompress( original ); 258 | 259 | expect(retrieved).toEqual(expected); 260 | }); 261 | describe('JSONC.pack', function(){ 262 | it('should test that returns the expected string', function(){ 263 | var retrieved, 264 | obj = {A:3}, 265 | packed = '{"a":3}'; 266 | 267 | window.gzip = { 268 | zip: function( str ){ 269 | return [123, 34, 65, 34, 58, 51, 125]; 270 | } 271 | }; 272 | window.Base64 = { 273 | encode: function( str ){ 274 | return str.toLowerCase(); 275 | } 276 | }; 277 | 278 | 279 | retrieved = JSONC.pack( obj ); 280 | 281 | expect(packed).toEqual(retrieved); 282 | 283 | delete window.Base64; 284 | delete window.gzip; 285 | }); 286 | it('should test that returns the expected string', function(){ 287 | var retrieved, 288 | obj = {A:3}, 289 | packed = '{"a":3}'; 290 | 291 | window.gzip = { 292 | zip: function() 293 | { 294 | return [123, 34, 65, 34, 58, 51, 125]; 295 | } 296 | }; 297 | window.Base64 = { 298 | encode: function( str ){ 299 | return str.toLowerCase(); 300 | } 301 | }; 302 | 303 | retrieved = JSONC.pack( obj, true ); 304 | 305 | expect(packed).toEqual(retrieved); 306 | 307 | delete window.Base64; 308 | delete window.gzip; 309 | }); 310 | }); 311 | describe('JSONC.unpack', function(){ 312 | it('should test that returns the expected object', function(){ 313 | var retrieved, 314 | obj = {A:3}, 315 | packed = '{"A":3}'; 316 | 317 | window.gzip = { 318 | unzip: function() 319 | { 320 | return [123, 34, 65, 34, 58, 51, 125]; 321 | } 322 | }; 323 | window.Base64 = { 324 | decode: function( str ) 325 | { 326 | return str; 327 | } 328 | }; 329 | 330 | retrieved = JSONC.unpack( packed ); 331 | 332 | expect(retrieved).toEqual(obj); 333 | 334 | delete window.Base64; 335 | delete window.gzip; 336 | }); 337 | it('should test that returns the expected object', function(){ 338 | var retrieved, 339 | obj = {A:3}, 340 | packed = '{"A":3,"_":{"A":"A"}}'; 341 | window.gzip = { 342 | unzip: function() 343 | { 344 | return [123, 34, 65, 34, 58, 51, 44, 34, 95, 34, 58, 123, 34, 65, 34, 58, 34, 65, 34, 125, 125]; 345 | } 346 | }; 347 | window.Base64 = { 348 | decode: function( str ) 349 | { 350 | return str; 351 | } 352 | }; 353 | 354 | retrieved = JSONC.unpack( packed, true ); 355 | 356 | expect(retrieved).toEqual(obj); 357 | 358 | delete window.Base64; 359 | delete window.gzip; 360 | }); 361 | }); 362 | }); -------------------------------------------------------------------------------- /versions/jsonc.min.js: -------------------------------------------------------------------------------- 1 | /*! JSONC.js v1.6.1 | Date:2015-10-26 | License: https://raw.github.com/tcorral/JSONC/master/LICENSE| (c) 2013 2 | //@ sourceMappingURL=jsonc.min.map 3 | */ 4 | var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(a){var b="";var c,d,e,f,g,h,i;var j=0;a=Base64._utf8_encode(a);while(j>2,g=(3&c)<<4|d>>4,h=(15&d)<<2|e>>6,i=63&e,isNaN(d)?h=i=64:isNaN(e)&&(i=64),b=b+this._keyStr.charAt(f)+this._keyStr.charAt(g)+this._keyStr.charAt(h)+this._keyStr.charAt(i);return b},decode:function(a){var b="";var c,d,e;var f,g,h,i;var j=0;a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(j>4,d=(15&g)<<4|h>>2,e=(3&h)<<6|i,b+=String.fromCharCode(c),64!=h&&(b+=String.fromCharCode(d)),64!=i&&(b+=String.fromCharCode(e));return b=Base64._utf8_decode(b)},_utf8_encode:function(a){a=a.replace(/\r\n/g,"\n");var b="";for(var c=0;cd?b+=String.fromCharCode(d):d>127&&2048>d?(b+=String.fromCharCode(192|d>>6),b+=String.fromCharCode(128|63&d)):(b+=String.fromCharCode(224|d>>12),b+=String.fromCharCode(128|63&d>>6),b+=String.fromCharCode(128|63&d))}return b},_utf8_decode:function(a){var b="";var c=0;var d=c1=c2=0;while(cd?(b+=String.fromCharCode(d),c++):d>191&&224>d?(c2=a.charCodeAt(c+1),b+=String.fromCharCode((31&d)<<6|63&c2),c+=2):(c2=a.charCodeAt(c+1),c3=a.charCodeAt(c+2),b+=String.fromCharCode((15&d)<<12|(63&c2)<<6|63&c3),c+=3);return b}};void function(a,b){"object"==typeof module?module.exports=b():"function"==typeof define?define(b):a.crc32=b()}(this,function(){"use strict";var a=[],b=3988292384;function c(){var c,d,e;for(d=0;256>d;d+=1){for(c=d,e=0;8>e;e+=1)1&c?c=b^c>>>1:c>>>=1;a[d]=c>>>0}}function d(a){return Array.prototype.map.call(a,function(a){return a.charCodeAt(0)})}function e(a){var c=-1,d,e,f,g;for(d=0,f=a.length;f>d;d+=1){for(g=255&(c^a[d]),e=0;8>e;e+=1)1===(1&g)?g=g>>>1^b:g>>>=1;c=c>>>8^g}return-1^c}function f(b,c){var d,e,g;if("undefined"!=typeof f.crc&&c&&b||(f.crc=-1,b)){for(d=f.crc,e=0,g=b.length;g>e;e+=1)d=d>>>8^a[255&(d^b[e])];return f.crc=d,-1^d}}c();var g=function(a,b){var a="string"==typeof a?d(a):a,c=b?e(a):f(a);return(c>>>0).toString(16)};return g.direct=e,g.table=f,g}),function(a){var b=32768,c=0,d=1,e=2,f=6,g=!1,h=32768,i=8192,j=2*b,k=3,l=258,m=16,n=8192,o=15,p=n,q=1<h&&console.error("error: INBUFSIZ is too small"),b<<1>1<m-1&&console.error("error: HASH_BITS is too large"),(8>o||258!==l)&&console.error("error: Code too clever");function Ob(){this.fc=0,this.dl=0}function Pb(){this.dyn_tree=null,this.static_tree=null,this.extra_bits=null,this.extra_base=0,this.elems=0,this.max_length=0,this.max_code=0}function Qb(a,b,c,d){this.good_length=a,this.max_lazy=b,this.nice_length=c,this.max_chain=d}function Rb(){this.next=null,this.len=0,this.ptr=[],this.off=0}var Sb=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0];var Tb=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];var Ub=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];var Vb=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];var Wb=[new Qb(0,0,0,0),new Qb(4,4,8,4),new Qb(4,5,16,8),new Qb(4,6,32,32),new Qb(4,4,16,16),new Qb(8,16,32,32),new Qb(8,16,128,128),new Qb(8,32,128,256),new Qb(32,128,258,1024),new Qb(32,258,258,4096)];function Xb(a){var b;if(a?1>a?a=1:a>9&&(a=9):a=f,kb=a,O=!1,gb=!1,null===P){for(L=M=N=null,P=[],T=[],U=[],V=[],W=[],nb=[],b=0;J>b;b++)nb[b]=new Ob;for(ob=[],b=0;2*E+1>b;b++)ob[b]=new Ob;for(pb=[],b=0;D+2>b;b++)pb[b]=new Ob;for(qb=[],b=0;E>b;b++)qb[b]=new Ob;for(rb=[],b=0;2*F+1>b;b++)rb[b]=new Ob;sb=new Pb,tb=new Pb,ub=new Pb,vb=[],wb=[],zb=[],Ab=[],Bb=[],Cb=[],Db=[],Eb=[]}}function Yb(){L=M=N=null,P=null,T=null,U=null,V=null,W=null,nb=null,ob=null,pb=null,qb=null,rb=null,sb=null,tb=null,ub=null,vb=null,wb=null,zb=null,Ab=null,Bb=null,Cb=null,Db=null,Eb=null}function Zb(a){a.next=L,L=a}function $b(){var a;return null!==L?(a=L,L=L.next):a=new Rb,a.next=null,a.len=a.off=0,a}function _b(a){return W[b+a]}function ac(a,c){return W[b+a]=c}function bc(a){P[R+Q++]=a,R+Q===i&&Hc()}function cc(a){a&=65535,i-2>R+Q?(P[R+Q++]=255&a,P[R+Q++]=a>>>8):(bc(255&a),bc(a>>>8))}function dc(){$=($<a?Bb[a]:Bb[256+(a>>7)])}function gc(a,b,c){return a[b].fcd&&Nba;a++)W[b+a]=0;if(jb=Wb[kb].max_lazy,lb=Wb[kb].good_length,g||(mb=Wb[kb].nice_length),ib=Wb[kb].max_chain,eb=0,Z=0,hb=hc(T,0,2*b),0>=hb)return gb=!0,hb=0,void 0;gb=!1;while(v>hb&&!gb)kc();for($=0,a=0;k-1>a;a++)$=($<w?eb-w:t;var i=eb+l;var j=T[c+f-1];var k=T[c+f];var m,n;db>=lb&&(b>>=2);do if(d=a,T[d+f]===k&&T[d+f-1]===j&&T[d]===T[c]&&T[++d]===T[c+1]){c+=2,d++;while(i>c){for(n=!1,m=0;8>m;m+=1)if(c+=1,d+=1,T[c]!==T[d]){n=!0;break}if(n)break}if(e=l-(i-c),c=i-l,e>f){if(fb=a,f=e,g){if(e>=l)break}else if(e>=mb)break;j=T[c+f-1],k=T[c+f]}}while((a=W[a&s])>h&&0!==--b);return f}function kc(){var a,c;var d=j-hb-eb;if(-1===d)d--;else if(eb>=b+w){for(a=0;b>a;a++)T[a]=T[a+b];for(fb-=b,eb-=b,Z-=b,a=0;q>a;a++)c=_b(a),ac(a,c>=b?c-b:t);for(a=0;b>a;a++)c=W[a],W[a]=c>=b?c-b:t;d+=b}gb||(a=hc(T,eb+hb,d),0>=a?gb=!0:hb+=a)}function lc(){while(0!==hb&&null===M){var a;if(dc(),_!==t&&w>=eb-_&&(cb=jc(_),cb>hb&&(cb=hb)),cb>=k)if(a=Bc(eb-fb,cb-k),hb-=cb,jb>=cb){cb--;do eb++,dc();while(0!==--cb);eb++}else eb+=cb,cb=0,$=255&T[eb],$=($<hb&&!gb)kc()}}function mc(){while(0!==hb&&null===M){if(dc(),db=cb,ab=fb,cb=k-1,_!==t&&jb>db&&w>=eb-_&&(cb=jc(_),cb>hb&&(cb=hb),cb===k&&eb-fb>u&&cb--),db>=k&&db>=cb){var a;a=Bc(eb-1-ab,db-k),hb-=db-1,db-=2;do eb++,dc();while(0!==--db);bb=!1,cb=k-1,eb++,a&&(Ac(0),Z=eb)}else bb?(Bc(0,255&T[eb-1])&&(Ac(0),Z=eb),eb++,hb--):(bb=!0,eb++,hb--);while(v>hb&&!gb)kc()}}function nc(){gb||(X=0,Y=0,qc(),ic(),M=null,Q=0,R=0,3>=kb?(db=k-1,cb=0):(cb=k-1,bb=!1),S=!1)}function oc(a,b,c){var d;return O||(nc(),O=!0,0!==hb)?(d=pc(a,b,c),d===c?c:S?d:(3>=kb?lc():mc(),0===hb&&(bb&&Bc(0,255&T[eb-1]),Ac(1),S=!0),d+pc(a,d+b,c-d))):(S=!0,0)}function pc(a,b,c){var d,e,f;d=0;while(null!==M&&c>d){for(e=c-d,e>M.len&&(e=M.len),f=0;e>f;f++)a[b+d+f]=M.ptr[M.off+f];if(M.off+=e,M.len-=e,d+=e,0===M.len){var g;g=M,M=M.next,Zb(g)}}if(d===c)return d;if(Q>R){for(e=c-d,e>Q-R&&(e=Q-R),f=0;e>f;f++)a[b+d+f]=P[R+f];R+=e,d+=e,Q===R&&(Q=R=0)}return d}function qc(){var a;var b;var c;var d;var e;if(0===qb[0].dl){for(sb.dyn_tree=nb,sb.static_tree=pb,sb.extra_bits=Sb,sb.extra_base=B+1,sb.elems=D,sb.max_length=y,sb.max_code=0,tb.dyn_tree=ob,tb.static_tree=qb,tb.extra_bits=Tb,tb.extra_base=0,tb.elems=E,tb.max_length=y,tb.max_code=0,ub.dyn_tree=rb,ub.static_tree=null,ub.extra_bits=Ub,ub.extra_base=0,ub.elems=F,ub.max_length=z,ub.max_code=0,c=0,d=0;A-1>d;d++)for(Cb[d]=c,a=0;a<1<d;d++)for(Db[d]=e,a=0;a<1<>=7;E>d;d++)for(Db[d]=e<<7,a=0;a<1<=b;b++)vb[b]=0;a=0;while(143>=a)pb[a++].dl=8,vb[8]++;while(255>=a)pb[a++].dl=9,vb[9]++;while(279>=a)pb[a++].dl=7,vb[7]++;while(287>=a)pb[a++].dl=8,vb[8]++;for(uc(pb,D+1),a=0;E>a;a++)qb[a].dl=5,qb[a].fc=Fc(a,5);rc()}}function rc(){var a;for(a=0;D>a;a++)nb[a].fc=0;for(a=0;E>a;a++)ob[a].fc=0;for(a=0;F>a;a++)rb[a].fc=0;nb[C].fc=1,Kb=Lb=0,Fb=Gb=Hb=0,Ib=0,Jb=1}function sc(a,b){var c=wb[b],d=b<<1;while(xb>=d){if(xb>d&&gc(a,wb[d+1],wb[d])&&d++,gc(a,c,wb[d]))break;wb[b]=wb[d],b=d,d<<=1}wb[b]=c}function tc(a){var b=a.dyn_tree;var c=a.extra_bits;var d=a.extra_base;var e=a.max_code;var f=a.max_length;var g=a.static_tree;var h;var i,j;var k;var l;var m;var n=0;for(k=0;y>=k;k++)vb[k]=0;for(b[wb[yb]].dl=0,h=yb+1;J>h;h++)i=wb[h],k=b[b[i].dl].dl+1,k>f&&(k=f,n++),b[i].dl=k,i>e||(vb[k]++,l=0,i>=d&&(l=c[i-d]),m=b[i].fc,Kb+=m*(k+l),null!==g&&(Lb+=m*(g[i].dl+l)));if(0!==n){do{k=f-1;while(0===vb[k])k--;vb[k]--,vb[k+1]+=2,vb[f]--,n-=2}while(n>0);for(k=f;0!==k;k--){i=vb[k];while(0!==i)j=wb[--h],j>e||(b[j].dl!==k&&(Kb+=(k-b[j].dl)*b[j].fc,b[j].fc=k),i--)}}}function uc(a,b){var c=[];var d=0;var e;var f;for(e=1;y>=e;e++)d=d+vb[e-1]<<1,c[e]=d;for(f=0;b>=f;f++){var g=a[f].dl;0!==g&&(a[f].fc=Fc(c[g]++,g))}}function vc(a){var b=a.dyn_tree;var c=a.static_tree;var d=a.elems;var e,f;var g=-1;var h=d;for(xb=0,yb=J,e=0;d>e;e++)0!==b[e].fc?(wb[++xb]=g=e,zb[e]=0):b[e].dl=0;while(2>xb){var i=wb[++xb]=2>g?++g:0;b[i].fc=1,zb[i]=0,Kb--,null!==c&&(Lb-=c[i].dl)}for(a.max_code=g,e=xb>>1;e>=1;e--)sc(b,e);do e=wb[x],wb[x]=wb[xb--],sc(b,x),f=wb[x],wb[--yb]=e,wb[--yb]=f,b[h].fc=b[e].fc+b[f].fc,zb[h]=zb[e]>zb[f]+1?zb[e]:zb[f]+1,b[e].dl=b[f].dl=h,wb[x]=h++,sc(b,x);while(xb>=2);wb[--yb]=wb[x],tc(a),uc(b,g)}function wc(a,b){var c,d=-1,e,f=a[0].dl,g=0,h=7,i=4;for(0===f&&(h=138,i=3),a[b+1].dl=65535,c=0;b>=c;c++)e=f,f=a[c+1].dl,++gg?rb[e].fc+=g:0!==e?(e!==d&&rb[e].fc++,rb[G].fc++):10>=g?rb[H].fc++:rb[I].fc++,g=0,d=e,0===f?(h=138,i=3):e===f?(h=6,i=3):(h=7,i=4))}function xc(a,b){var c;var d=-1;var e;var f=a[0].dl;var g=0;var h=7;var i=4;for(0===f&&(h=138,i=3),c=0;b>=c;c++)if(e=f,f=a[c+1].dl,!(++gg){do ec(e,rb);while(0!==--g)}else 0!==e?(e!==d&&(ec(e,rb),g--),ec(G,rb),Ec(g-3,2)):10>=g?(ec(H,rb),Ec(g-3,3)):(ec(I,rb),Ec(g-11,7));g=0,d=e,0===f?(h=138,i=3):e===f?(h=6,i=3):(h=7,i=4)}}function yc(){var a;for(wc(nb,sb.max_code),wc(ob,tb.max_code),vc(ub),a=F-1;a>=3;a--)if(0!==rb[Vb[a]].dl)break;return Kb+=3*(a+1)+5+5+4,a}function zc(a,b,c){var d;for(Ec(a-257,5),Ec(b-1,5),Ec(c-4,4),d=0;c>d;d++)Ec(rb[Vb[d]].dl,3);xc(nb,a-1),xc(ob,b-1)}function Ac(a){var b,f,g,h,i;if(h=eb-Z,Eb[Hb]=Ib,vc(sb),vc(tb),g=yc(),b=Kb+3+7>>3,f=Lb+3+7>>3,b>=f&&(b=f),b>=h+4&&Z>=0)for(Ec((c<<1)+a,3),Gc(),cc(h),cc(~h),i=0;h>i;i++)bc(T[Z+i]);else f===b?(Ec((d<<1)+a,3),Cc(pb,qb)):(Ec((e<<1)+a,3),zc(sb.max_code+1,tb.max_code+1,g+1),Cc(nb,ob));rc(),0!==a&&Gc()}function Bc(a,b){if(V[Fb++]=b,0===a?nb[b].fc++:(a--,nb[Ab[b]+B+1].fc++,ob[fc(a)].fc++,U[Gb++]=a,Ib|=Jb),Jb<<=1,0===(7&Fb)&&(Eb[Hb++]=Ib,Ib=0,Jb=1),kb>2&&0===(4095&Fb)){var c=8*Fb;var d=eb-Z;var e;for(e=0;E>e;e++)c+=ob[e].fc*(5+Tb[e]);if(c>>=3,Gb>=1;while(Fb>e);ec(C,a)}var Dc=16;function Ec(a,b){Y>Dc-b?(X|=a<>Dc-Y,Y+=b-Dc):(X|=a<>=1,c<<=1;while(--b>0);return c>>1}function Gc(){Y>8?cc(X):Y>0&&bc(X),X=0,Y=0}function Hc(){var a,b;if(0!==Q){for(a=$b(),null===M?M=N=a:N=N.next=a,a.len=Q-R,b=0;b0);return Mb=null,e}a.deflate=Ic,a.DEFAULT_LEVEL=f}(deflate="undefined"==typeof deflate?{}:deflate),function(a){var b=32768,c=0,d=1,e=2,f=9,g=6,h,i,j=null,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],A=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],B=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,99,99],C=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],D=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],E=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];function F(){this.next=null,this.list=null}function G(){this.e=0,this.b=0,this.n=0,this.t=null}function H(a,b,c,d,e,f){this.BMAX=16,this.N_MAX=288,this.status=0,this.root=null,this.m=0;var g;var h=[];var i;var j;var k;var l;var m;var n;var o;var p=[];var q;var r;var s;var t=new G;var u=[];var v=[];var w;var x=[];var y;var z;var A;var B;var C;for(C=this.root=null,m=0;m256?a[256]:this.BMAX,q=a,r=0,m=b;do h[q[r]]++,r++;while(--m>0);if(h[0]===b)return this.root=null,this.m=0,this.status=0,void 0;for(n=1;n<=this.BMAX;n++)if(0!==h[n])break;for(o=n,n>f&&(f=n),m=this.BMAX;0!==m;m--)if(0!==h[m])break;for(k=m,f>m&&(f=m),z=1<n;n++,z<<=1)if((z-=h[n])<0)return this.status=2,this.m=f,void 0;if((z-=h[m])<0)return this.status=2,this.m=f,void 0;h[m]+=z,x[1]=n=0,q=h,r=1,y=2;while(--m>0)x[y++]=n+=q[r++];q=a,r=0,m=0;do 0!==(n=q[r++])&&(v[x[n]++]=m);while(++m=o;o++){g=h[o];while(g-->0){while(o>w+p[1+l]){if(w+=p[1+l],l++,A=(A=k-w)>f?f:A,(j=1<<(n=o-w))>g+1){j-=g+1,y=o;while(++ni&&i>w&&(n=i-w),A=1<B;B++)s[B]=new G;C=C?C.next=new F:this.root=new F,C.next=null,C.list=s,u[l]=s,l>0&&(x[l]=m,t.b=p[l],t.e=16+n,t.t=s,n=(m&(1<>w-p[l],u[l-1][n].e=t.e,u[l-1][n].b=t.b,u[l-1][n].n=t.n,u[l-1][n].t=t.t)}for(t.b=o-w,r>=b?t.e=99:q[r]>w;A>n;n+=j)s[n].e=t.e,s[n].b=t.b,s[n].n=t.n,s[n].t=t.t;for(n=1<>=1)m^=n;m^=n;while((m&(1<o)n|=I()<>=a,o-=a}function M(a,c,d){var e;var f;var g;if(0===d)return 0;for(g=0;;){J(v),f=t.list[K(v)],e=f.e;while(e>16){if(99===e)return-1;L(f.b),e-=16,J(e),f=f.t[K(e)],e=f.e}if(L(f.b),16!==e){if(15===e)break;J(e),r=f.n+K(e),L(e),J(w),f=u.list[K(w)],e=f.e;while(e>16){if(99===e)return-1;L(f.b),e-=16,J(e),f=f.t[K(e)],e=f.e}L(f.b),J(e),s=i-f.n-K(e),L(e);while(r>0&&d>g)r--,s&=b-1,i&=b-1,a[c+g++]=h[i++]=h[s++];if(g===d)return d}else if(i&=b-1,a[c+g++]=h[i++]=f.n,g===d)return d}return p=-1,g}function N(a,c,d){var e;if(e=7&o,L(e),J(16),e=K(16),L(16),J(16),e!==(65535&~n))return-1;L(16),r=e,e=0;while(r>0&&d>e)r--,i&=b-1,J(8),a[c+e++]=h[i++]=K(8),L(8);return 0===r&&(p=-1),e}function O(a,b,c){if(!j){var d;var e=[];var f;for(d=0;144>d;d++)e[d]=8;for(null;256>d;d++)e[d]=9;for(null;280>d;d++)e[d]=7;for(null;288>d;d++)e[d]=8;if(l=7,f=new H(e,288,257,A,B,l),0!==f.status)return console.error("HufBuild error: "+f.status),-1;for(j=f.root,l=f.m,d=0;30>d;d++)e[d]=5;if(m=5,f=new H(e,30,0,C,D,m),f.status>1)return j=null,console.error("HufBuild error: "+f.status),-1;k=f.root,m=f.m}return t=j,u=k,v=l,w=m,M(a,b,c)}function P(a,b,c){var d;var e;var h;var i;var j;var k;var l;var m;var n=[];var o;for(d=0;316>d;d++)n[d]=0;if(J(5),l=257+K(5),L(5),J(5),m=1+K(5),L(5),J(4),k=4+K(4),L(4),l>286||m>30)return-1;for(e=0;k>e;e++)J(3),n[E[e]]=K(3),L(3);for(null;19>e;e++)n[E[e]]=0;if(v=7,o=new H(n,19,19,null,null,v),0!==o.status)return-1;t=o.root,v=o.m,i=l+m,d=h=0;while(i>d)if(J(v),j=t.list[K(v)],e=j.b,L(e),e=j.n,16>e)n[d++]=h=e;else if(16===e){if(J(2),e=3+K(2),L(2),d+e>i)return-1;while(e-->0)n[d++]=h}else if(17===e){if(J(3),e=3+K(3),L(3),d+e>i)return-1;while(e-->0)n[d++]=0;h=0}else{if(J(7),e=11+K(7),L(7),d+e>i)return-1;while(e-->0)n[d++]=0;h=0}if(v=f,o=new H(n,l,257,A,B,v),0===v&&(o.status=1),0!==o.status&&1!==o.status)return-1;for(t=o.root,v=o.m,d=0;m>d;d++)n[d]=n[d+l];return w=g,o=new H(n,m,0,C,D,w),u=o.root,w=o.m,0===w&&l>257?-1:0!==o.status?-1:M(a,b,c)}function Q(){h||(h=[]),i=0,n=0,o=0,p=-1,q=!1,r=s=0,t=null}function R(a,f,g){var j,k;j=0;while(g>j){if(q&&-1===p)return j;if(r>0){if(p!==c)while(r>0&&g>j)r--,s&=b-1,i&=b-1,a[f+j++]=h[i++]=h[s++];else{while(r>0&&g>j)r--,i&=b-1,J(8),a[f+j++]=h[i++]=K(8),L(8);0===r&&(p=-1)}if(j===g)return j}if(-1===p){if(q)break;J(1),0!==K(1)&&(q=!0),L(1),J(2),p=K(2),L(2),t=null,r=0}switch(p){case c:k=N(a,f+j,g-j);break;case d:k=t?M(a,f+j,g-j):O(a,f+j,g-j);break;case e:k=t?M(a,f+j,g-j):P(a,f+j,g-j);break;default:k=-1}if(-1===k)return q?0:-1;j+=k}return j}function S(a){var b=[],c;Q(),x=a,y=0;do c=R(b,b.length,1024);while(c>0);return x=null,b}a.inflate=S}(deflate="undefined"==typeof deflate?{}:deflate),function(a){"use strict";var b=a.crc32,c=a.deflate,d=31,e=139,f={deflate:8},g={FTEXT:1,FHCRC:2,FEXTRA:4,FNAME:8,FCOMMENT:16},h={fat:0,amiga:1,vmz:2,unix:3,"vm/cms":4,atari:5,hpfs:6,macintosh:7,"z-system":8,cplm:9,"tops-20":10,ntfs:11,qdos:12,acorn:13,vfat:14,vms:15,beos:16,tandem:17,theos:18},i="unix",j=6;function k(a,b){b.push(255&a)}function l(a,b){b.push(255&a),b.push(a>>>8)}function m(a,b){l(65535&a,b),l(a>>>16,b)}function n(a,b){var c,d=a.length;for(c=0;d>c;c+=1)k(a.charCodeAt(c),b)}function o(a){return a.shift()}function p(a){return a.shift()|a.shift()<<8}function q(a){var b=p(a),c=p(a);return c>32768?(c-=32768,(c<<16|b)+32768*Math.pow(2,16)):c<<16|b}function r(a){var b=[];while(0!==a[0])b.push(String.fromCharCode(a.shift()));return a.shift(),b.join("")}function s(a,b){var c,d=[];for(c=0;b>c;c+=1)d.push(a.shift());return d}function t(a,l){var o=0,p,q,r=[];return l||(l={}),p=l.level||j,"string"==typeof a&&(a=Array.prototype.map.call(a,function(a){return a.charCodeAt(0)})),k(d,r),k(e,r),k(f.deflate,r),l.name&&(o|=g.FNAME),k(o,r),m(l.timestamp||parseInt(Date.now()/1e3,10),r),1===p?k(4,r):9===p?k(2,r):k(0,r),k(h[i],r),l.name&&(n(l.name.substring(l.name.lastIndexOf("/")+1),r),k(0,r)),c.deflate(a,p).forEach(function(a){k(a,r)}),m(parseInt(b(a),16),r),m(a.length,r),r}function u(a,i){var j=Array.prototype.slice.call(a,0),k,l,m,n,t,u,v,w,x,y;if(o(j)!==d||o(j)!==e)throw"Not a GZIP file";if(k=o(j),k=Object.keys(f).some(function(a){return l=a,f[a]===k}),!k)throw"Unsupported compression method";if(m=o(j),n=q(j),t=o(j),k=o(j),Object.keys(h).some(function(a){return h[a]===k?(v=a,!0):void 0}),m&g.FEXTRA&&(k=p(j),s(j,k)),m&g.FNAME&&r(j),m&g.FCOMMENT&&r(j),m&g.FHCRC&&p(j),"deflate"===l&&(y=c.inflate(j.splice(0,j.length-8))),m&g.FTEXT&&(y=Array.prototype.map.call(y,function(a){return String.fromCharCode(a)}).join("")),w=q(j),w!==parseInt(b(y),16))throw"Checksum does not match";if(x=q(j),x!==y.length)throw"Size of decompressed file not correct";return y}a.gzip={zip:t,unzip:u,get DEFAULT_LEVEL(){return j}}}(this),function(){var a,b={},c,d=-1,e={}.toString;a=this,c="object"==typeof exports&&"object"==typeof module&&"object"==typeof module.exports&&"function"==typeof require;function f(a,b){var c,d=a.length;for(c=0;d>c;c++)if(a[c][1]===b)return!0;return!1}function g(a){var b,c=a.length,d=[];for(b=0;c>b;b++)f(d,a[b][1])||d.push(a[b]);return d}function h(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}function i(a){return"[object Object]"===e.call(a)}function j(a){return"[object Array]"===e.call(a)}function k(a){var b={},c,d=a.length,e;for(c=0;d>c;c++)e=a[c],b[e[0]]=e[1];return b}function l(a,b,c){var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=_!?()*",e=[],f=a;b=b||d.length,c=c||0;while(f>=b)e.push(d.charCodeAt(f%b+c)),f=Math.floor(f/b-1);return e.push(d.charCodeAt(f+c)),e.reverse()}function m(a){return String.fromCharCode.apply(String,a)}function n(a,b){var c,e,h;for(e in a)a.hasOwnProperty(e)&&(h=a[e],(i(h)||j(h))&&(b=b.concat(g(n(h,b)))),isNaN(Number(e))&&(f(b,e)||(d+=1,c=[],c.push(m(l(d)),e),b.push(c))));return b}function o(a,c){var d,e;for(d=0,e=a.length;e>d;d++)a[d]=b.compress(a[d],c)}function p(a,b){var c,d,e,f,i,j;for(b=n(a,b),b=g(b),c=k(b),e=JSON.stringify(a),f=b.length,i=0;f>i;i++)d=b[i],e=e.replace(new RegExp(h('"'+d[1]+'"'),"g"),'"'+d[0]+'"');return j=JSON.parse(e),j._=c,j}function q(a){var c,d;for(c=0,d=a.length;d>c;c++)a[c]=b.decompress(a[c])}function r(a){var b,c,d;b=JSON.parse(JSON.stringify(a._)),delete a._,c=JSON.stringify(a);for(d in b)b.hasOwnProperty(d)&&(c=c.replace(new RegExp('"'+d+'"',"g"),'"'+b[d]+'"'));return c}b.compress=function(a,b){b||(d=-1);var c=b||[],e;return j(a)?(o(a,c),e=a):e=p(a,c),e},b.pack=function(a,c){var d=JSON.stringify(c?b.compress(a):a);return Base64.encode(String.fromCharCode.apply(String,gzip.zip(d,{level:9})))},b.decompress=function(a){var b,c=JSON.parse(JSON.stringify(a));return j(c)?q(c):b=r(c),b?JSON.parse(b):c};function s(a){var b=0,c=a.length,d=[];for(;c>b;b++)d.push(a.charCodeAt(b));return d}b.unpack=function(a,c){var d=s(Base64.decode(a)),e=String.fromCharCode.apply(String,gzip.unzip(d,{level:9})),f=JSON.parse(e);return c?b.decompress(f):f},a.JSONC=b,c?module.exports=b:"undefined"!=typeof define&&define("jsoncomp",[],function(){return b})}.call(this); 5 | //# sourceMappingURL=jsonc.min.map 6 | -------------------------------------------------------------------------------- /vendor/rawinflate.js: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id: rawinflate.js,v 0.2 2009/03/01 18:32:24 dankogai Exp $ 3 | * 4 | * original: 5 | * http://www.onicos.com/staff/iz/amuse/javascript/expert/inflate.txt 6 | */ 7 | 8 | /* Copyright (C) 1999 Masanao Izumo 9 | * Version: 1.0.0.1 10 | * LastModified: Dec 25 1999 11 | */ 12 | 13 | /* Interface: 14 | * data = inflate(src); 15 | */ 16 | 17 | (function (global) { 18 | /* constant parameters */ 19 | var WSIZE = 32768, // Sliding Window size 20 | STORED_BLOCK = 0, 21 | STATIC_TREES = 1, 22 | DYN_TREES = 2, 23 | 24 | /* for inflate */ 25 | lbits = 9, // bits in base literal/length lookup table 26 | dbits = 6, // bits in base distance lookup table 27 | 28 | /* variables (inflate) */ 29 | slide, 30 | wp, // current position in slide 31 | fixed_tl = null, // inflate static 32 | fixed_td, // inflate static 33 | fixed_bl, // inflate static 34 | fixed_bd, // inflate static 35 | bit_buf, // bit buffer 36 | bit_len, // bits in bit buffer 37 | method, 38 | eof, 39 | copy_leng, 40 | copy_dist, 41 | tl, // literal length decoder table 42 | td, // literal distance decoder table 43 | bl, // number of bits decoded by tl 44 | bd, // number of bits decoded by td 45 | 46 | inflate_data, 47 | inflate_pos, 48 | 49 | 50 | /* constant tables (inflate) */ 51 | MASK_BITS = [ 52 | 0x0000, 53 | 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, 54 | 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff 55 | ], 56 | // Tables for deflate from PKZIP's appnote.txt. 57 | // Copy lengths for literal codes 257..285 58 | cplens = [ 59 | 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 60 | 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0 61 | ], 62 | /* note: see note #13 above about the 258 in this list. */ 63 | // Extra bits for literal codes 257..285 64 | cplext = [ 65 | 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 66 | 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 99, 99 // 99==invalid 67 | ], 68 | // Copy offsets for distance codes 0..29 69 | cpdist = [ 70 | 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 71 | 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 72 | 8193, 12289, 16385, 24577 73 | ], 74 | // Extra bits for distance codes 75 | cpdext = [ 76 | 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 77 | 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 78 | 12, 12, 13, 13 79 | ], 80 | // Order of the bit length code lengths 81 | border = [ 82 | 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 83 | ]; 84 | /* objects (inflate) */ 85 | 86 | function HuftList() { 87 | this.next = null; 88 | this.list = null; 89 | } 90 | 91 | function HuftNode() { 92 | this.e = 0; // number of extra bits or operation 93 | this.b = 0; // number of bits in this code or subcode 94 | 95 | // union 96 | this.n = 0; // literal, length base, or distance base 97 | this.t = null; // (HuftNode) pointer to next level of table 98 | } 99 | 100 | /* 101 | * @param b- code lengths in bits (all assumed <= BMAX) 102 | * @param n- number of codes (assumed <= N_MAX) 103 | * @param s- number of simple-valued codes (0..s-1) 104 | * @param d- list of base values for non-simple codes 105 | * @param e- list of extra bits for non-simple codes 106 | * @param mm- maximum lookup bits 107 | */ 108 | function HuftBuild(b, n, s, d, e, mm) { 109 | this.BMAX = 16; // maximum bit length of any code 110 | this.N_MAX = 288; // maximum number of codes in any set 111 | this.status = 0; // 0: success, 1: incomplete table, 2: bad input 112 | this.root = null; // (HuftList) starting table 113 | this.m = 0; // maximum lookup bits, returns actual 114 | 115 | /* Given a list of code lengths and a maximum table size, make a set of 116 | tables to decode that set of codes. Return zero on success, one if 117 | the given code set is incomplete (the tables are still built in this 118 | case), two if the input is invalid (all zero length codes or an 119 | oversubscribed set of lengths), and three if not enough memory. 120 | The code with value 256 is special, and the tables are constructed 121 | so that no bits beyond that code are fetched when that code is 122 | decoded. */ 123 | var a; // counter for codes of length k 124 | var c = []; 125 | var el; // length of EOB code (value 256) 126 | var f; // i repeats in table every f entries 127 | var g; // maximum code length 128 | var h; // table level 129 | var i; // counter, current code 130 | var j; // counter 131 | var k; // number of bits in current code 132 | var lx = []; 133 | var p; // pointer into c[], b[], or v[] 134 | var pidx; // index of p 135 | var q; // (HuftNode) points to current table 136 | var r = new HuftNode(); // table entry for structure assignment 137 | var u = []; 138 | var v = []; 139 | var w; 140 | var x = []; 141 | var xp; // pointer into x or c 142 | var y; // number of dummy codes added 143 | var z; // number of entries in current table 144 | var o; 145 | var tail; // (HuftList) 146 | 147 | tail = this.root = null; 148 | 149 | // bit length count table 150 | for (i = 0; i < this.BMAX + 1; i++) { 151 | c[i] = 0; 152 | } 153 | // stack of bits per table 154 | for (i = 0; i < this.BMAX + 1; i++) { 155 | lx[i] = 0; 156 | } 157 | // HuftNode[BMAX][] table stack 158 | for (i = 0; i < this.BMAX; i++) { 159 | u[i] = null; 160 | } 161 | // values in order of bit length 162 | for (i = 0; i < this.N_MAX; i++) { 163 | v[i] = 0; 164 | } 165 | // bit offsets, then code stack 166 | for (i = 0; i < this.BMAX + 1; i++) { 167 | x[i] = 0; 168 | } 169 | 170 | // Generate counts for each bit length 171 | el = n > 256 ? b[256] : this.BMAX; // set length of EOB code, if any 172 | p = b; pidx = 0; 173 | i = n; 174 | do { 175 | c[p[pidx]]++; // assume all entries <= BMAX 176 | pidx++; 177 | } while (--i > 0); 178 | if (c[0] === n) { // null input--all zero length codes 179 | this.root = null; 180 | this.m = 0; 181 | this.status = 0; 182 | return; 183 | } 184 | 185 | // Find minimum and maximum length, bound *m by those 186 | for (j = 1; j <= this.BMAX; j++) { 187 | if (c[j] !== 0) { 188 | break; 189 | } 190 | } 191 | k = j; // minimum code length 192 | if (mm < j) { 193 | mm = j; 194 | } 195 | for (i = this.BMAX; i !== 0; i--) { 196 | if (c[i] !== 0) { 197 | break; 198 | } 199 | } 200 | g = i; // maximum code length 201 | if (mm > i) { 202 | mm = i; 203 | } 204 | 205 | // Adjust last length count to fill out codes, if needed 206 | for (y = 1 << j; j < i; j++, y <<= 1) { 207 | if ((y -= c[j]) < 0) { 208 | this.status = 2; // bad input: more codes than bits 209 | this.m = mm; 210 | return; 211 | } 212 | } 213 | if ((y -= c[i]) < 0) { 214 | this.status = 2; 215 | this.m = mm; 216 | return; 217 | } 218 | c[i] += y; 219 | 220 | // Generate starting offsets into the value table for each length 221 | x[1] = j = 0; 222 | p = c; 223 | pidx = 1; 224 | xp = 2; 225 | while (--i > 0) { // note that i == g from above 226 | x[xp++] = (j += p[pidx++]); 227 | } 228 | 229 | // Make a table of values in order of bit lengths 230 | p = b; pidx = 0; 231 | i = 0; 232 | do { 233 | if ((j = p[pidx++]) !== 0) { 234 | v[x[j]++] = i; 235 | } 236 | } while (++i < n); 237 | n = x[g]; // set n to length of v 238 | 239 | // Generate the Huffman codes and for each, make the table entries 240 | x[0] = i = 0; // first Huffman code is zero 241 | p = v; pidx = 0; // grab values in bit order 242 | h = -1; // no tables yet--level -1 243 | w = lx[0] = 0; // no bits decoded yet 244 | q = null; // ditto 245 | z = 0; // ditto 246 | 247 | // go through the bit lengths (k already is bits in shortest code) 248 | for (null; k <= g; k++) { 249 | a = c[k]; 250 | while (a-- > 0) { 251 | // here i is the Huffman code of length k bits for value p[pidx] 252 | // make tables up to required level 253 | while (k > w + lx[1 + h]) { 254 | w += lx[1 + h]; // add bits already decoded 255 | h++; 256 | 257 | // compute minimum size table less than or equal to *m bits 258 | z = (z = g - w) > mm ? mm : z; // upper limit 259 | if ((f = 1 << (j = k - w)) > a + 1) { // try a k-w bit table 260 | // too few codes for k-w bit table 261 | f -= a + 1; // deduct codes from patterns left 262 | xp = k; 263 | while (++j < z) { // try smaller tables up to z bits 264 | if ((f <<= 1) <= c[++xp]) { 265 | break; // enough codes to use up j bits 266 | } 267 | f -= c[xp]; // else deduct codes from patterns 268 | } 269 | } 270 | if (w + j > el && w < el) { 271 | j = el - w; // make EOB code end at table 272 | } 273 | z = 1 << j; // table entries for j-bit table 274 | lx[1 + h] = j; // set table size in stack 275 | 276 | // allocate and link in new table 277 | q = []; 278 | for (o = 0; o < z; o++) { 279 | q[o] = new HuftNode(); 280 | } 281 | 282 | if (!tail) { 283 | tail = this.root = new HuftList(); 284 | } else { 285 | tail = tail.next = new HuftList(); 286 | } 287 | tail.next = null; 288 | tail.list = q; 289 | u[h] = q; // table starts after link 290 | 291 | /* connect to last table, if there is one */ 292 | if (h > 0) { 293 | x[h] = i; // save pattern for backing up 294 | r.b = lx[h]; // bits to dump before this table 295 | r.e = 16 + j; // bits in this table 296 | r.t = q; // pointer to this table 297 | j = (i & ((1 << w) - 1)) >> (w - lx[h]); 298 | u[h - 1][j].e = r.e; 299 | u[h - 1][j].b = r.b; 300 | u[h - 1][j].n = r.n; 301 | u[h - 1][j].t = r.t; 302 | } 303 | } 304 | 305 | // set up table entry in r 306 | r.b = k - w; 307 | if (pidx >= n) { 308 | r.e = 99; // out of values--invalid code 309 | } else if (p[pidx] < s) { 310 | r.e = (p[pidx] < 256 ? 16 : 15); // 256 is end-of-block code 311 | r.n = p[pidx++]; // simple code is just the value 312 | } else { 313 | r.e = e[p[pidx] - s]; // non-simple--look up in lists 314 | r.n = d[p[pidx++] - s]; 315 | } 316 | 317 | // fill code-like entries with r // 318 | f = 1 << (k - w); 319 | for (j = i >> w; j < z; j += f) { 320 | q[j].e = r.e; 321 | q[j].b = r.b; 322 | q[j].n = r.n; 323 | q[j].t = r.t; 324 | } 325 | 326 | // backwards increment the k-bit code i 327 | for (j = 1 << (k - 1); (i & j) !== 0; j >>= 1) { 328 | i ^= j; 329 | } 330 | i ^= j; 331 | 332 | // backup over finished tables 333 | while ((i & ((1 << w) - 1)) !== x[h]) { 334 | w -= lx[h]; // don't need to update q 335 | h--; 336 | } 337 | } 338 | } 339 | 340 | /* return actual size of base table */ 341 | this.m = lx[1]; 342 | 343 | /* Return true (1) if we were given an incomplete table */ 344 | this.status = ((y !== 0 && g !== 1) ? 1 : 0); 345 | } 346 | 347 | 348 | /* routines (inflate) */ 349 | 350 | function GET_BYTE() { 351 | if (inflate_data.length === inflate_pos) { 352 | return -1; 353 | } 354 | return inflate_data[inflate_pos++] & 0xff; 355 | } 356 | 357 | function NEEDBITS(n) { 358 | while (bit_len < n) { 359 | bit_buf |= GET_BYTE() << bit_len; 360 | bit_len += 8; 361 | } 362 | } 363 | 364 | function GETBITS(n) { 365 | return bit_buf & MASK_BITS[n]; 366 | } 367 | 368 | function DUMPBITS(n) { 369 | bit_buf >>= n; 370 | bit_len -= n; 371 | } 372 | 373 | function inflate_codes(buff, off, size) { 374 | // inflate (decompress) the codes in a deflated (compressed) block. 375 | // Return an error code or zero if it all goes ok. 376 | var e; // table entry flag/number of extra bits 377 | var t; // (HuftNode) pointer to table entry 378 | var n; 379 | 380 | if (size === 0) { 381 | return 0; 382 | } 383 | 384 | // inflate the coded data 385 | n = 0; 386 | for (;;) { // do until end of block 387 | NEEDBITS(bl); 388 | t = tl.list[GETBITS(bl)]; 389 | e = t.e; 390 | while (e > 16) { 391 | if (e === 99) { 392 | return -1; 393 | } 394 | DUMPBITS(t.b); 395 | e -= 16; 396 | NEEDBITS(e); 397 | t = t.t[GETBITS(e)]; 398 | e = t.e; 399 | } 400 | DUMPBITS(t.b); 401 | 402 | if (e === 16) { // then it's a literal 403 | wp &= WSIZE - 1; 404 | buff[off + n++] = slide[wp++] = t.n; 405 | if (n === size) { 406 | return size; 407 | } 408 | continue; 409 | } 410 | 411 | // exit if end of block 412 | if (e === 15) { 413 | break; 414 | } 415 | 416 | // it's an EOB or a length 417 | 418 | // get length of block to copy 419 | NEEDBITS(e); 420 | copy_leng = t.n + GETBITS(e); 421 | DUMPBITS(e); 422 | 423 | // decode distance of block to copy 424 | NEEDBITS(bd); 425 | t = td.list[GETBITS(bd)]; 426 | e = t.e; 427 | 428 | while (e > 16) { 429 | if (e === 99) { 430 | return -1; 431 | } 432 | DUMPBITS(t.b); 433 | e -= 16; 434 | NEEDBITS(e); 435 | t = t.t[GETBITS(e)]; 436 | e = t.e; 437 | } 438 | DUMPBITS(t.b); 439 | NEEDBITS(e); 440 | copy_dist = wp - t.n - GETBITS(e); 441 | DUMPBITS(e); 442 | 443 | // do the copy 444 | while (copy_leng > 0 && n < size) { 445 | copy_leng--; 446 | copy_dist &= WSIZE - 1; 447 | wp &= WSIZE - 1; 448 | buff[off + n++] = slide[wp++] = slide[copy_dist++]; 449 | } 450 | 451 | if (n === size) { 452 | return size; 453 | } 454 | } 455 | 456 | method = -1; // done 457 | return n; 458 | } 459 | 460 | function inflate_stored(buff, off, size) { 461 | /* "decompress" an inflated type 0 (stored) block. */ 462 | var n; 463 | 464 | // go to byte boundary 465 | n = bit_len & 7; 466 | DUMPBITS(n); 467 | 468 | // get the length and its complement 469 | NEEDBITS(16); 470 | n = GETBITS(16); 471 | DUMPBITS(16); 472 | NEEDBITS(16); 473 | if (n !== ((~bit_buf) & 0xffff)) { 474 | return -1; // error in compressed data 475 | } 476 | DUMPBITS(16); 477 | 478 | // read and output the compressed data 479 | copy_leng = n; 480 | 481 | n = 0; 482 | while (copy_leng > 0 && n < size) { 483 | copy_leng--; 484 | wp &= WSIZE - 1; 485 | NEEDBITS(8); 486 | buff[off + n++] = slide[wp++] = GETBITS(8); 487 | DUMPBITS(8); 488 | } 489 | 490 | if (copy_leng === 0) { 491 | method = -1; // done 492 | } 493 | return n; 494 | } 495 | 496 | function inflate_fixed(buff, off, size) { 497 | // decompress an inflated type 1 (fixed Huffman codes) block. We should 498 | // either replace this with a custom decoder, or at least precompute the 499 | // Huffman tables. 500 | 501 | // if first time, set up tables for fixed blocks 502 | if (!fixed_tl) { 503 | var i; // temporary variable 504 | var l = []; // 288 length list for huft_build (initialized below) 505 | var h; // HuftBuild 506 | 507 | // literal table 508 | for (i = 0; i < 144; i++) { 509 | l[i] = 8; 510 | } 511 | for (null; i < 256; i++) { 512 | l[i] = 9; 513 | } 514 | for (null; i < 280; i++) { 515 | l[i] = 7; 516 | } 517 | for (null; i < 288; i++) { // make a complete, but wrong code set 518 | l[i] = 8; 519 | } 520 | fixed_bl = 7; 521 | 522 | h = new HuftBuild(l, 288, 257, cplens, cplext, fixed_bl); 523 | if (h.status !== 0) { 524 | console.error("HufBuild error: " + h.status); 525 | return -1; 526 | } 527 | fixed_tl = h.root; 528 | fixed_bl = h.m; 529 | 530 | // distance table 531 | for (i = 0; i < 30; i++) { // make an incomplete code set 532 | l[i] = 5; 533 | } 534 | fixed_bd = 5; 535 | 536 | h = new HuftBuild(l, 30, 0, cpdist, cpdext, fixed_bd); 537 | if (h.status > 1) { 538 | fixed_tl = null; 539 | console.error("HufBuild error: " + h.status); 540 | return -1; 541 | } 542 | fixed_td = h.root; 543 | fixed_bd = h.m; 544 | } 545 | 546 | tl = fixed_tl; 547 | td = fixed_td; 548 | bl = fixed_bl; 549 | bd = fixed_bd; 550 | return inflate_codes(buff, off, size); 551 | } 552 | 553 | function inflate_dynamic(buff, off, size) { 554 | // decompress an inflated type 2 (dynamic Huffman codes) block. 555 | var i; // temporary variables 556 | var j; 557 | var l; // last length 558 | var n; // number of lengths to get 559 | var t; // (HuftNode) literal/length code table 560 | var nb; // number of bit length codes 561 | var nl; // number of literal/length codes 562 | var nd; // number of distance codes 563 | var ll = []; 564 | var h; // (HuftBuild) 565 | 566 | // literal/length and distance code lengths 567 | for (i = 0; i < 286 + 30; i++) { 568 | ll[i] = 0; 569 | } 570 | 571 | // read in table lengths 572 | NEEDBITS(5); 573 | nl = 257 + GETBITS(5); // number of literal/length codes 574 | DUMPBITS(5); 575 | NEEDBITS(5); 576 | nd = 1 + GETBITS(5); // number of distance codes 577 | DUMPBITS(5); 578 | NEEDBITS(4); 579 | nb = 4 + GETBITS(4); // number of bit length codes 580 | DUMPBITS(4); 581 | if (nl > 286 || nd > 30) { 582 | return -1; // bad lengths 583 | } 584 | 585 | // read in bit-length-code lengths 586 | for (j = 0; j < nb; j++) { 587 | NEEDBITS(3); 588 | ll[border[j]] = GETBITS(3); 589 | DUMPBITS(3); 590 | } 591 | for (null; j < 19; j++) { 592 | ll[border[j]] = 0; 593 | } 594 | 595 | // build decoding table for trees--single level, 7 bit lookup 596 | bl = 7; 597 | h = new HuftBuild(ll, 19, 19, null, null, bl); 598 | if (h.status !== 0) { 599 | return -1; // incomplete code set 600 | } 601 | 602 | tl = h.root; 603 | bl = h.m; 604 | 605 | // read in literal and distance code lengths 606 | n = nl + nd; 607 | i = l = 0; 608 | while (i < n) { 609 | NEEDBITS(bl); 610 | t = tl.list[GETBITS(bl)]; 611 | j = t.b; 612 | DUMPBITS(j); 613 | j = t.n; 614 | if (j < 16) { // length of code in bits (0..15) 615 | ll[i++] = l = j; // save last length in l 616 | } else if (j === 16) { // repeat last length 3 to 6 times 617 | NEEDBITS(2); 618 | j = 3 + GETBITS(2); 619 | DUMPBITS(2); 620 | if (i + j > n) { 621 | return -1; 622 | } 623 | while (j-- > 0) { 624 | ll[i++] = l; 625 | } 626 | } else if (j === 17) { // 3 to 10 zero length codes 627 | NEEDBITS(3); 628 | j = 3 + GETBITS(3); 629 | DUMPBITS(3); 630 | if (i + j > n) { 631 | return -1; 632 | } 633 | while (j-- > 0) { 634 | ll[i++] = 0; 635 | } 636 | l = 0; 637 | } else { // j === 18: 11 to 138 zero length codes 638 | NEEDBITS(7); 639 | j = 11 + GETBITS(7); 640 | DUMPBITS(7); 641 | if (i + j > n) { 642 | return -1; 643 | } 644 | while (j-- > 0) { 645 | ll[i++] = 0; 646 | } 647 | l = 0; 648 | } 649 | } 650 | 651 | // build the decoding tables for literal/length and distance codes 652 | bl = lbits; 653 | h = new HuftBuild(ll, nl, 257, cplens, cplext, bl); 654 | if (bl === 0) { // no literals or lengths 655 | h.status = 1; 656 | } 657 | if (h.status !== 0) { 658 | if (h.status !== 1) { 659 | return -1; // incomplete code set 660 | } 661 | // **incomplete literal tree** 662 | } 663 | tl = h.root; 664 | bl = h.m; 665 | 666 | for (i = 0; i < nd; i++) { 667 | ll[i] = ll[i + nl]; 668 | } 669 | bd = dbits; 670 | h = new HuftBuild(ll, nd, 0, cpdist, cpdext, bd); 671 | td = h.root; 672 | bd = h.m; 673 | 674 | if (bd === 0 && nl > 257) { // lengths but no distances 675 | // **incomplete distance tree** 676 | return -1; 677 | } 678 | /* 679 | if (h.status === 1) { 680 | // **incomplete distance tree** 681 | } 682 | */ 683 | if (h.status !== 0) { 684 | return -1; 685 | } 686 | 687 | // decompress until an end-of-block code 688 | return inflate_codes(buff, off, size); 689 | } 690 | 691 | function inflate_start() { 692 | if (!slide) { 693 | slide = []; // new Array(2 * WSIZE); // slide.length is never called 694 | } 695 | wp = 0; 696 | bit_buf = 0; 697 | bit_len = 0; 698 | method = -1; 699 | eof = false; 700 | copy_leng = copy_dist = 0; 701 | tl = null; 702 | } 703 | 704 | function inflate_internal(buff, off, size) { 705 | // decompress an inflated entry 706 | var n, i; 707 | 708 | n = 0; 709 | while (n < size) { 710 | if (eof && method === -1) { 711 | return n; 712 | } 713 | 714 | if (copy_leng > 0) { 715 | if (method !== STORED_BLOCK) { 716 | // STATIC_TREES or DYN_TREES 717 | while (copy_leng > 0 && n < size) { 718 | copy_leng--; 719 | copy_dist &= WSIZE - 1; 720 | wp &= WSIZE - 1; 721 | buff[off + n++] = slide[wp++] = slide[copy_dist++]; 722 | } 723 | } else { 724 | while (copy_leng > 0 && n < size) { 725 | copy_leng--; 726 | wp &= WSIZE - 1; 727 | NEEDBITS(8); 728 | buff[off + n++] = slide[wp++] = GETBITS(8); 729 | DUMPBITS(8); 730 | } 731 | if (copy_leng === 0) { 732 | method = -1; // done 733 | } 734 | } 735 | if (n === size) { 736 | return n; 737 | } 738 | } 739 | 740 | if (method === -1) { 741 | if (eof) { 742 | break; 743 | } 744 | 745 | // read in last block bit 746 | NEEDBITS(1); 747 | if (GETBITS(1) !== 0) { 748 | eof = true; 749 | } 750 | DUMPBITS(1); 751 | 752 | // read in block type 753 | NEEDBITS(2); 754 | method = GETBITS(2); 755 | DUMPBITS(2); 756 | tl = null; 757 | copy_leng = 0; 758 | } 759 | 760 | switch (method) { 761 | case STORED_BLOCK: 762 | i = inflate_stored(buff, off + n, size - n); 763 | break; 764 | 765 | case STATIC_TREES: 766 | if (tl) { 767 | i = inflate_codes(buff, off + n, size - n); 768 | } else { 769 | i = inflate_fixed(buff, off + n, size - n); 770 | } 771 | break; 772 | 773 | case DYN_TREES: 774 | if (tl) { 775 | i = inflate_codes(buff, off + n, size - n); 776 | } else { 777 | i = inflate_dynamic(buff, off + n, size - n); 778 | } 779 | break; 780 | 781 | default: // error 782 | i = -1; 783 | break; 784 | } 785 | 786 | if (i === -1) { 787 | if (eof) { 788 | return 0; 789 | } 790 | return -1; 791 | } 792 | n += i; 793 | } 794 | return n; 795 | } 796 | 797 | function inflate(arr) { 798 | var buff = [], i; 799 | 800 | inflate_start(); 801 | inflate_data = arr; 802 | inflate_pos = 0; 803 | 804 | do { 805 | i = inflate_internal(buff, buff.length, 1024); 806 | } while (i > 0); 807 | inflate_data = null; // G.C. 808 | return buff; 809 | } 810 | 811 | global.inflate = inflate; 812 | }((deflate = typeof deflate === "undefined" ? {}: deflate))); 813 | -------------------------------------------------------------------------------- /Benchmark/obj/demo_pack_gzip_with_base64/data/data2.js: -------------------------------------------------------------------------------- 1 | var obj2 = { 2 | "oInputs":{ 3 | "user_apps":{ 4 | "{244FD30F-63F1-49B9-9D98-1150FF4FFCB1}":{ 5 | "sRegistryKey":"{244FD30F-63F1-49B9-9D98-1150FF4FFCB1}", 6 | "sArchitecture":"x86", 7 | "sRegistryName":"Adobe Extension Manager CC", 8 | "sRegistryVersion":"7.0", 9 | "oInstallDate":"2013-07-31T06:23:35.000Z", 10 | "nIdFile":null, 11 | "oProgram":null 12 | }, 13 | "Adobe Flash Player ActiveX":{ 14 | "sRegistryKey":"Adobe Flash Player ActiveX", 15 | "sArchitecture":"x86", 16 | "sRegistryName":"Adobe Flash Player 11 ActiveX", 17 | "sRegistryVersion":"11.9.900.117", 18 | "oInstallDate":"2013-10-09T11:13:52.000Z", 19 | "nIdFile":null, 20 | "oProgram":null 21 | }, 22 | "Adobe Flash Player Plugin":{ 23 | "sRegistryKey":"Adobe Flash Player Plugin", 24 | "sArchitecture":"x86", 25 | "sRegistryName":"Adobe Flash Player 11 Plugin", 26 | "sRegistryVersion":"11.9.900.117", 27 | "oInstallDate":"2013-10-10T05:13:21.000Z", 28 | "nIdFile":null, 29 | "oProgram":null 30 | }, 31 | "{AC76BA86-7AD7-1033-7B44-AA1000000001}":{ 32 | "sRegistryKey":"{AC76BA86-7AD7-1033-7B44-AA1000000001}", 33 | "sArchitecture":"x86", 34 | "sRegistryName":"Adobe Reader X (10.1.3)", 35 | "sRegistryVersion":"10.1.3", 36 | "oInstallDate":"2013-01-15T11:54:21.000Z", 37 | "nIdFile":null, 38 | "oProgram":null 39 | }, 40 | "{100E94A6-F85A-E828-9EE3-C1DD14706B6A}":{ 41 | "sRegistryKey":"{100E94A6-F85A-E828-9EE3-C1DD14706B6A}", 42 | "sArchitecture":"x64", 43 | "sRegistryName":"AMD Catalyst Install Manager", 44 | "sRegistryVersion":"3.0.855.0", 45 | "oInstallDate":"2013-01-15T12:54:19.000Z", 46 | "nIdFile":null, 47 | "oProgram":null 48 | }, 49 | "{2EF5D87E-B7BD-458F-8428-E4D0B8B4E65C}":{ 50 | "sRegistryKey":"{2EF5D87E-B7BD-458F-8428-E4D0B8B4E65C}", 51 | "sArchitecture":"x64", 52 | "sRegistryName":"Apple Mobile Device Support", 53 | "sRegistryVersion":"7.0.0.117", 54 | "oInstallDate":"2013-10-24T05:30:55.000Z", 55 | "nIdFile":null, 56 | "oProgram":null 57 | }, 58 | "{789A5B64-9DD9-4BA5-915A-F0FC0A1B7BFE}":{ 59 | "sRegistryKey":"{789A5B64-9DD9-4BA5-915A-F0FC0A1B7BFE}", 60 | "sArchitecture":"x86", 61 | "sRegistryName":"Apple Software Update", 62 | "sRegistryVersion":"2.1.3.127", 63 | "oInstallDate":"2013-01-16T07:45:09.000Z", 64 | "nIdFile":null, 65 | "oProgram":null 66 | }, 67 | "Aptana Studio 3":{ 68 | "sRegistryKey":"Aptana Studio 3", 69 | "sArchitecture":"x86", 70 | "sRegistryName":"Aptana Studio 3", 71 | "sRegistryVersion":"3.0.1", 72 | "oInstallDate":"2013-01-22T13:40:32.000Z", 73 | "nIdFile":null, 74 | "oProgram":null 75 | }, 76 | "{6E3610B2-430D-4EB0-81E3-2B57E8B9DE8D}":{ 77 | "sRegistryKey":"{6E3610B2-430D-4EB0-81E3-2B57E8B9DE8D}", 78 | "sArchitecture":"x64", 79 | "sRegistryName":"Bonjour", 80 | "sRegistryVersion":"3.0.0.10", 81 | "oInstallDate":"2013-10-24T05:30:34.000Z", 82 | "nIdFile":null, 83 | "oProgram":null 84 | }, 85 | "{28446157-77CA-4C2E-A16F-4EA467B7EC75}":{ 86 | "sRegistryKey":"{28446157-77CA-4C2E-A16F-4EA467B7EC75}", 87 | "sArchitecture":"x64", 88 | "sRegistryName":"BYTEPASSclient", 89 | "sRegistryVersion":"6.7.0.0", 90 | "oInstallDate":"2013-01-16T07:36:19.000Z", 91 | "nIdFile":null, 92 | "oProgram":null 93 | }, 94 | "CCleaner":{ 95 | "sRegistryKey":"CCleaner", 96 | "sArchitecture":"x64", 97 | "sRegistryName":"CCleaner", 98 | "sRegistryVersion":"3.05", 99 | "oInstallDate":"2013-10-04T08:33:18.000Z", 100 | "nIdFile":null, 101 | "oProgram":null 102 | }, 103 | "{6D2BEDF9-06CA-42FF-B6C2-EB6B935041D3}":{ 104 | "sRegistryKey":"{6D2BEDF9-06CA-42FF-B6C2-EB6B935041D3}", 105 | "sArchitecture":"x64", 106 | "sRegistryName":"Charles 3.8.1", 107 | "sRegistryVersion":"3.8.1.2", 108 | "oInstallDate":"2013-10-10T05:29:44.000Z", 109 | "nIdFile":null, 110 | "oProgram":null 111 | }, 112 | "{46F044A5-CE8B-4196-984E-5BD6525E361D}":{ 113 | "sRegistryKey":"{46F044A5-CE8B-4196-984E-5BD6525E361D}", 114 | "sArchitecture":"x86", 115 | "sRegistryName":"Compatibilidad con Aplicaciones de Apple", 116 | "sRegistryVersion":"2.3.6", 117 | "oInstallDate":"2013-10-24T05:30:29.000Z", 118 | "nIdFile":null, 119 | "oProgram":null 120 | }, 121 | "{AA467959-A1D6-4F45-90CD-11DC57733F32}":{ 122 | "sRegistryKey":"{AA467959-A1D6-4F45-90CD-11DC57733F32}", 123 | "sArchitecture":"x86", 124 | "sRegistryName":"Crystal Reports Basic for Visual Studio 2008", 125 | "sRegistryVersion":"10.5.0.0", 126 | "oInstallDate":"2013-01-22T13:50:06.000Z", 127 | "nIdFile":null, 128 | "oProgram":null 129 | }, 130 | "doPDF 7 printer_is1":{ 131 | "sRegistryKey":"doPDF 7 printer_is1", 132 | "sArchitecture":"x64", 133 | "sRegistryName":"doPDF 7.3 printer", 134 | "sRegistryVersion":"7.3", 135 | "oInstallDate":"2013-01-15T11:56:49.000Z", 136 | "nIdFile":null, 137 | "oProgram":null 138 | }, 139 | "EditPlus 3":{ 140 | "sRegistryKey":"EditPlus 3", 141 | "sArchitecture":"x86", 142 | "sRegistryName":"EditPlus 3", 143 | "sRegistryVersion":"", 144 | "oInstallDate":"2013-01-16T07:42:11.000Z", 145 | "nIdFile":null, 146 | "oProgram":null 147 | }, 148 | "Fiddler2":{ 149 | "sRegistryKey":"Fiddler2", 150 | "sArchitecture":"x86", 151 | "sRegistryName":"Fiddler2", 152 | "sRegistryVersion":"2.4.0.0", 153 | "oInstallDate":"2013-01-16T07:43:24.000Z", 154 | "nIdFile":null, 155 | "oProgram":null 156 | }, 157 | "{A60534C2-CC0D-4367-A472-62F1829A300D}":{ 158 | "sRegistryKey":"{A60534C2-CC0D-4367-A472-62F1829A300D}", 159 | "sArchitecture":"x64", 160 | "sRegistryName":"Files_Comparer", 161 | "sRegistryVersion":"2.6", 162 | "oInstallDate":"2013-01-16T07:47:23.000Z", 163 | "nIdFile":null, 164 | "oProgram":null 165 | }, 166 | "FileZilla Client":{ 167 | "sRegistryKey":"FileZilla Client", 168 | "sArchitecture":"x86", 169 | "sRegistryName":"FileZilla Client 3.5.3", 170 | "sRegistryVersion":"3.5.3", 171 | "oInstallDate":"2013-01-15T11:57:08.000Z", 172 | "nIdFile":null, 173 | "oProgram":null 174 | }, 175 | "WinGimp-2.0_is1":{ 176 | "sRegistryKey":"WinGimp-2.0_is1", 177 | "sArchitecture":"x86", 178 | "sRegistryName":"GIMP 2.6.12", 179 | "sRegistryVersion":"2.6.12", 180 | "oInstallDate":"2013-01-15T15:03:50.000Z", 181 | "nIdFile":null, 182 | "oProgram":null 183 | }, 184 | "Git_is1":{ 185 | "sRegistryKey":"Git_is1", 186 | "sArchitecture":"x86", 187 | "sRegistryName":"Git version 1.8.4-preview20130916", 188 | "sRegistryVersion":"1.8.4", 189 | "oInstallDate":"2013-09-19T05:47:51.000Z", 190 | "nIdFile":null, 191 | "oProgram":null 192 | }, 193 | "Google Chrome":{ 194 | "sRegistryKey":"Google Chrome", 195 | "sArchitecture":"x86", 196 | "sRegistryName":"Google Chrome", 197 | "sRegistryVersion":"30.0.1599.101", 198 | "oInstallDate":"2013-10-18T09:54:46.000Z", 199 | "nIdFile":null, 200 | "oProgram":null 201 | }, 202 | "Google Chrome SxS":{ 203 | "sRegistryKey":"Google Chrome SxS", 204 | "sArchitecture":"x86", 205 | "sRegistryName":"Google Chrome Canary", 206 | "sRegistryVersion":"32.0.1679.0", 207 | "oInstallDate":"2013-10-23T10:09:20.000Z", 208 | "nIdFile":null, 209 | "oProgram":null 210 | }, 211 | "{378817B1-CD10-4DB2-A31C-A9CBA2D85CF9}":{ 212 | "sRegistryKey":"{378817B1-CD10-4DB2-A31C-A9CBA2D85CF9}", 213 | "sArchitecture":"x64", 214 | "sRegistryName":"HeidiSQL", 215 | "sRegistryVersion":"7.0", 216 | "oInstallDate":"2013-01-16T07:59:47.000Z", 217 | "nIdFile":null, 218 | "oProgram":null 219 | }, 220 | "PROSet":{ 221 | "sRegistryKey":"PROSet", 222 | "sArchitecture":"x64", 223 | "sRegistryName":"Intel(R) Network Connections Drivers", 224 | "sRegistryVersion":"17.3", 225 | "oInstallDate":"2013-01-15T12:41:56.000Z", 226 | "nIdFile":null, 227 | "oProgram":null 228 | }, 229 | "{240C3DDD-C5E9-4029-9DF7-95650D040CF2}":{ 230 | "sRegistryKey":"{240C3DDD-C5E9-4029-9DF7-95650D040CF2}", 231 | "sArchitecture":"x86", 232 | "sRegistryName":"Intel(R) USB 3.0 eXtensible Host Controller Driver", 233 | "sRegistryVersion":"1.0.4.220", 234 | "oInstallDate":"2013-01-15T12:45:19.000Z", 235 | "nIdFile":null, 236 | "oProgram":null 237 | }, 238 | "{37D0157F-45C6-4DB2-9AE5-489DD98CE169}":{ 239 | "sRegistryKey":"{37D0157F-45C6-4DB2-9AE5-489DD98CE169}", 240 | "sArchitecture":"x64", 241 | "sRegistryName":"iTunes", 242 | "sRegistryVersion":"11.1.2.31", 243 | "oInstallDate":"2013-10-24T05:31:33.000Z", 244 | "nIdFile":null, 245 | "oProgram":null 246 | }, 247 | "{26A24AE4-039D-4CA4-87B4-2F83217011FF}":{ 248 | "sRegistryKey":"{26A24AE4-039D-4CA4-87B4-2F83217011FF}", 249 | "sArchitecture":"x86", 250 | "sRegistryName":"Java 7 Update 11", 251 | "sRegistryVersion":"7.0.110", 252 | "oInstallDate":"2013-01-15T12:33:04.000Z", 253 | "nIdFile":null, 254 | "oProgram":null 255 | }, 256 | "{26A24AE4-039D-4CA4-87B4-2F86417011FF}":{ 257 | "sRegistryKey":"{26A24AE4-039D-4CA4-87B4-2F86417011FF}", 258 | "sArchitecture":"x64", 259 | "sRegistryName":"Java 7 Update 11 (64-bit)", 260 | "sRegistryVersion":"7.0.110", 261 | "oInstallDate":"2013-01-15T12:33:38.000Z", 262 | "nIdFile":null, 263 | "oProgram":null 264 | }, 265 | "{32A3A4F4-B792-11D6-A78A-00B0D0170110}":{ 266 | "sRegistryKey":"{32A3A4F4-B792-11D6-A78A-00B0D0170110}", 267 | "sArchitecture":"x86", 268 | "sRegistryName":"Java SE Development Kit 7 Update 11", 269 | "sRegistryVersion":"1.7.0.110", 270 | "oInstallDate":"2013-01-16T08:13:20.000Z", 271 | "nIdFile":null, 272 | "oProgram":null 273 | }, 274 | "{64A3A4F4-B792-11D6-A78A-00B0D0170110}":{ 275 | "sRegistryKey":"{64A3A4F4-B792-11D6-A78A-00B0D0170110}", 276 | "sArchitecture":"x64", 277 | "sRegistryName":"Java SE Development Kit 7 Update 11 (64-bit)", 278 | "sRegistryVersion":"1.7.0.110", 279 | "oInstallDate":"2013-01-16T07:55:57.000Z", 280 | "nIdFile":null, 281 | "oProgram":null 282 | }, 283 | "PhpStorm 5.0.4":{ 284 | "sRegistryKey":"PhpStorm 5.0.4", 285 | "sArchitecture":"x86", 286 | "sRegistryName":"JetBrains PhpStorm 5.0.4", 287 | "sRegistryVersion":"121.390", 288 | "oInstallDate":"2013-01-16T08:12:21.000Z", 289 | "nIdFile":null, 290 | "oProgram":null 291 | }, 292 | "PhpStorm 6.0.3":{ 293 | "sRegistryKey":"PhpStorm 6.0.3", 294 | "sArchitecture":"x86", 295 | "sRegistryName":"JetBrains PhpStorm 6.0.3", 296 | "sRegistryVersion":"129.814", 297 | "oInstallDate":"2013-07-09T06:54:16.000Z", 298 | "nIdFile":null, 299 | "oProgram":null 300 | }, 301 | "RegexBuddy 3":{ 302 | "sRegistryKey":"RegexBuddy 3", 303 | "sArchitecture":"x86", 304 | "sRegistryName":"Just Great Software RegexBuddy 3 v.3.4.2", 305 | "sRegistryVersion":"3.4.2", 306 | "oInstallDate":"2013-01-16T07:50:15.000Z", 307 | "nIdFile":null, 308 | "oProgram":null 309 | }, 310 | "7ec527eb7361b1c2":{ 311 | "sRegistryKey":"7ec527eb7361b1c2", 312 | "sArchitecture":"x86", 313 | "sRegistryName":"LiveReload", 314 | "sRegistryVersion":"0.9.2.0", 315 | "oInstallDate":"2013-07-09T06:58:06.000Z", 316 | "nIdFile":null, 317 | "oProgram":null 318 | }, 319 | "MSIE":{ 320 | "sRegistryKey":"MSIE", 321 | "sArchitecture":"x86", 322 | "sRegistryName":"Microsoft Internet Explorer", 323 | "sRegistryVersion":"", 324 | "oInstallDate":"2013-01-14T23:00:00.000Z", 325 | "nIdFile":null, 326 | "oProgram":null 327 | }, 328 | "{7D9109C3-58A9-4AFD-A1D3-47E7D811726E}":{ 329 | "sRegistryKey":"{7D9109C3-58A9-4AFD-A1D3-47E7D811726E}", 330 | "sArchitecture":"x64", 331 | "sRegistryName":"Microsoft Lync 2010", 332 | "sRegistryVersion":"4.0.7577.4356", 333 | "oInstallDate":"2013-07-09T06:45:07.000Z", 334 | "nIdFile":null, 335 | "oProgram":null 336 | }, 337 | "{89F4137D-6C26-4A84-BDB8-2E5A4BB71E00}":{ 338 | "sRegistryKey":"{89F4137D-6C26-4A84-BDB8-2E5A4BB71E00}", 339 | "sArchitecture":"x86", 340 | "sRegistryName":"Microsoft Silverlight", 341 | "sRegistryVersion":"4.1.10329.0", 342 | "oInstallDate":"2013-01-15T15:08:03.000Z", 343 | "nIdFile":null, 344 | "oProgram":null 345 | }, 346 | "Microsoft Visual Studio 2008 Professional Edition - ENU":{ 347 | "sRegistryKey":"Microsoft Visual Studio 2008 Professional Edition - ENU", 348 | "sArchitecture":"x86", 349 | "sRegistryName":"Microsoft Visual Studio 2008 Professional Edition - ENU", 350 | "sRegistryVersion":"", 351 | "oInstallDate":"2013-01-22T13:46:40.000Z", 352 | "nIdFile":null, 353 | "oProgram":null 354 | }, 355 | "Microsoft Visual Studio 2008 Remote Debugger - ENU":{ 356 | "sRegistryKey":"Microsoft Visual Studio 2008 Remote Debugger - ENU", 357 | "sArchitecture":"x64", 358 | "sRegistryName":"Microsoft Visual Studio 2008 Remote Debugger - ENU", 359 | "sRegistryVersion":"", 360 | "oInstallDate":"2013-01-22T13:49:46.000Z", 361 | "nIdFile":null, 362 | "oProgram":null 363 | }, 364 | "Mozilla Firefox 23.0 (x86 en-US)":{ 365 | "sRegistryKey":"Mozilla Firefox 23.0 (x86 en-US)", 366 | "sArchitecture":"x86", 367 | "sRegistryName":"Mozilla Firefox 23.0 (x86 en-US)", 368 | "sRegistryVersion":"23.0", 369 | "oInstallDate":"2013-10-21T13:20:23.000Z", 370 | "nIdFile":null, 371 | "oProgram":null 372 | }, 373 | "MozillaMaintenanceService":{ 374 | "sRegistryKey":"MozillaMaintenanceService", 375 | "sArchitecture":"x86", 376 | "sRegistryName":"Mozilla Maintenance Service", 377 | "sRegistryVersion":"23.0", 378 | "oInstallDate":"2013-10-21T13:20:23.000Z", 379 | "nIdFile":null, 380 | "oProgram":null 381 | }, 382 | "{561BD069-5C63-4B48-98BD-91B743142304}":{ 383 | "sRegistryKey":"{561BD069-5C63-4B48-98BD-91B743142304}", 384 | "sArchitecture":"x86", 385 | "sRegistryName":"MySQL Workbench 5.2 CE", 386 | "sRegistryVersion":"5.2.39", 387 | "oInstallDate":"2013-01-16T07:58:54.000Z", 388 | "nIdFile":null, 389 | "oProgram":null 390 | }, 391 | "nbi-nb-base-7.1.1.0.0":{ 392 | "sRegistryKey":"nbi-nb-base-7.1.1.0.0", 393 | "sArchitecture":"x64", 394 | "sRegistryName":"NetBeans IDE 7.1.1", 395 | "sRegistryVersion":"7.1.1", 396 | "oInstallDate":"2013-01-16T08:01:54.000Z", 397 | "nIdFile":null, 398 | "oProgram":null 399 | }, 400 | "{AEB59FD6-9876-462B-84D5-CDEA914F7244}":{ 401 | "sRegistryKey":"{AEB59FD6-9876-462B-84D5-CDEA914F7244}", 402 | "sArchitecture":"x64", 403 | "sRegistryName":"Node.js", 404 | "sRegistryVersion":"0.10.12", 405 | "oInstallDate":"2013-07-09T07:05:55.000Z", 406 | "nIdFile":null, 407 | "oProgram":null 408 | }, 409 | "Notepad++":{ 410 | "sRegistryKey":"Notepad++", 411 | "sArchitecture":"x86", 412 | "sRegistryName":"Notepad++", 413 | "sRegistryVersion":"6.4.5", 414 | "oInstallDate":"2013-09-17T04:28:03.000Z", 415 | "nIdFile":null, 416 | "oProgram":null 417 | }, 418 | "Opera 12.12.1707":{ 419 | "sRegistryKey":"Opera 12.12.1707", 420 | "sArchitecture":"x86", 421 | "sRegistryName":"Opera 12.12", 422 | "sRegistryVersion":"12.12.1707", 423 | "oInstallDate":"2013-01-16T07:35:12.000Z", 424 | "nIdFile":null, 425 | "oProgram":null 426 | }, 427 | "{DBDD570E-0952-475f-9453-AB88F3DD5659}":{ 428 | "sRegistryKey":"{DBDD570E-0952-475f-9453-AB88F3DD5659}", 429 | "sArchitecture":"x86", 430 | "sRegistryName":"Python 2.7.5", 431 | "sRegistryVersion":"2.7.5150", 432 | "oInstallDate":"2013-07-09T07:05:06.000Z", 433 | "nIdFile":null, 434 | "oProgram":null 435 | }, 436 | "{7BE15435-2D3E-4B58-867F-9C75BED0208C}":{ 437 | "sRegistryKey":"{7BE15435-2D3E-4B58-867F-9C75BED0208C}", 438 | "sArchitecture":"x86", 439 | "sRegistryName":"QuickTime", 440 | "sRegistryVersion":"7.71.80.42", 441 | "oInstallDate":"2013-01-16T07:53:04.000Z", 442 | "nIdFile":null, 443 | "oProgram":null 444 | }, 445 | "{65E859BA-5BD7-4936-938B-4B151FED1263}":{ 446 | "sRegistryKey":"{65E859BA-5BD7-4936-938B-4B151FED1263}", 447 | "sArchitecture":"x86", 448 | "sRegistryName":"QvPluginSetup", 449 | "sRegistryVersion":"10.00.9282.8", 450 | "oInstallDate":"2013-07-09T10:49:00.000Z", 451 | "nIdFile":null, 452 | "oProgram":null 453 | }, 454 | "{DB83EDF9-61D2-4084-8352-9A39DE014591}":{ 455 | "sRegistryKey":"{DB83EDF9-61D2-4084-8352-9A39DE014591}", 456 | "sArchitecture":"x64", 457 | "sRegistryName":"Regex_Coach", 458 | "sRegistryVersion":"0.9.2", 459 | "oInstallDate":"2013-01-16T07:49:22.000Z", 460 | "nIdFile":null, 461 | "oProgram":null 462 | }, 463 | "{B5BD4615-7C8A-4E50-9179-71B593CA6B67}_is1":{ 464 | "sRegistryKey":"{B5BD4615-7C8A-4E50-9179-71B593CA6B67}_is1", 465 | "sArchitecture":"x86", 466 | "sRegistryName":"Ruby 2.0.0-p247-x64", 467 | "sRegistryVersion":"2.0.0", 468 | "oInstallDate":"2013-07-09T07:07:21.000Z", 469 | "nIdFile":null, 470 | "oProgram":null 471 | }, 472 | "{C779648B-410E-4BBA-B75B-5815BCEFE71D}":{ 473 | "sRegistryKey":"{C779648B-410E-4BBA-B75B-5815BCEFE71D}", 474 | "sArchitecture":"x86", 475 | "sRegistryName":"Safari", 476 | "sRegistryVersion":"5.34.57.2", 477 | "oInstallDate":"2013-01-16T07:45:30.000Z", 478 | "nIdFile":null, 479 | "oProgram":null 480 | }, 481 | "SdSsOk":{ 482 | "sRegistryKey":"SdSsOk", 483 | "sArchitecture":"x86", 484 | "sRegistryName":"SdSsOk", 485 | "sRegistryVersion":"5.3.32", 486 | "oInstallDate":"2013-09-26T13:35:55.000Z", 487 | "nIdFile":null, 488 | "oProgram":null 489 | }, 490 | "{8088F4DB-B82A-4F2E-96F9-12647CE5DE1A}":{ 491 | "sRegistryKey":"{8088F4DB-B82A-4F2E-96F9-12647CE5DE1A}", 492 | "sArchitecture":"x64", 493 | "sRegistryName":"Snagit10", 494 | "sRegistryVersion":"10.0", 495 | "oInstallDate":"2013-01-15T12:14:53.000Z", 496 | "nIdFile":null, 497 | "oProgram":null 498 | }, 499 | "Softonic for Windows":{ 500 | "sRegistryKey":"Softonic for Windows", 501 | "sArchitecture":"x86", 502 | "sRegistryName":"Softonic for Windows", 503 | "sRegistryVersion":"1.5.3", 504 | "oInstallDate":"2013-10-17T04:37:55.000Z", 505 | "nIdFile":null, 506 | "oProgram":null 507 | }, 508 | "{9BC716C2-40C5-4156-942C-6773A2B5C8BE}_is1":{ 509 | "sRegistryKey":"{9BC716C2-40C5-4156-942C-6773A2B5C8BE}_is1", 510 | "sArchitecture":"x86", 511 | "sRegistryName":"Softools version 1.6", 512 | "sRegistryVersion":"1.6", 513 | "oInstallDate":"2013-07-09T09:40:26.000Z", 514 | "nIdFile":null, 515 | "oProgram":null 516 | }, 517 | "Spotify":{ 518 | "sRegistryKey":"Spotify", 519 | "sArchitecture":"x86", 520 | "sRegistryName":"Spotify", 521 | "sRegistryVersion":"0.9.4.185", 522 | "oInstallDate":"2013-10-24T05:22:30.000Z", 523 | "nIdFile":null, 524 | "oProgram":null 525 | }, 526 | "Sublime Text 2_is1":{ 527 | "sRegistryKey":"Sublime Text 2_is1", 528 | "sArchitecture":"x64", 529 | "sRegistryName":"Sublime Text 2.0.1", 530 | "sRegistryVersion":"2.0.1", 531 | "oInstallDate":"2013-01-22T13:38:01.000Z", 532 | "nIdFile":null, 533 | "oProgram":null 534 | }, 535 | "{281F26E7-6713-49DE-A7D8-289D0A147AB8}":{ 536 | "sRegistryKey":"{281F26E7-6713-49DE-A7D8-289D0A147AB8}", 537 | "sArchitecture":"x86", 538 | "sRegistryName":"Symantec pcAnywhere", 539 | "sRegistryVersion":"12.5.4.8096", 540 | "oInstallDate":"2013-07-09T09:14:09.000Z", 541 | "nIdFile":null, 542 | "oProgram":null 543 | }, 544 | "{DCC5B9E2-D918-4B9D-93FF-062D8AB987EE}":{ 545 | "sRegistryKey":"{DCC5B9E2-D918-4B9D-93FF-062D8AB987EE}", 546 | "sArchitecture":"x64", 547 | "sRegistryName":"Symantec Workspace Virtualization Agent", 548 | "sRegistryVersion":"6.4.1346", 549 | "oInstallDate":"2013-07-09T10:00:27.000Z", 550 | "nIdFile":null, 551 | "oProgram":null 552 | }, 553 | "Microsoft Security Client":{ 554 | "sRegistryKey":"Microsoft Security Client", 555 | "sArchitecture":"x64", 556 | "sRegistryName":"System Center 2012 Endpoint Protection", 557 | "sRegistryVersion":"2.2.903.0", 558 | "oInstallDate":"2013-01-15T12:11:44.000Z", 559 | "nIdFile":null, 560 | "oProgram":null 561 | }, 562 | "{D2D22BEE-B7F1-49D0-9ED6-86D0B2CEDFAD}":{ 563 | "sRegistryKey":"{D2D22BEE-B7F1-49D0-9ED6-86D0B2CEDFAD}", 564 | "sArchitecture":"x64", 565 | "sRegistryName":"TortoiseSVN 1.7.6.22632 (64 bit)", 566 | "sRegistryVersion":"1.7.22632", 567 | "oInstallDate":"2013-01-16T07:46:36.000Z", 568 | "nIdFile":null, 569 | "oProgram":null 570 | }, 571 | "Vim 7.3":{ 572 | "sRegistryKey":"Vim 7.3", 573 | "sArchitecture":"x64", 574 | "sRegistryName":"Vim 7.3 (self-installing)", 575 | "sRegistryVersion":"7.3", 576 | "oInstallDate":"2013-07-09T06:55:12.000Z", 577 | "nIdFile":null, 578 | "oProgram":null 579 | }, 580 | "{D3E39E77-0EB4-36FB-B97A-8C8AB21B9A45}":{ 581 | "sRegistryKey":"{D3E39E77-0EB4-36FB-B97A-8C8AB21B9A45}", 582 | "sArchitecture":"x64", 583 | "sRegistryName":"Visual Studio .NET Prerequisites - English", 584 | "sRegistryVersion":"9.0.21022", 585 | "oInstallDate":"2013-01-22T13:42:13.000Z", 586 | "nIdFile":null, 587 | "oProgram":null 588 | }, 589 | "VLC media player":{ 590 | "sRegistryKey":"VLC media player", 591 | "sArchitecture":"x86", 592 | "sRegistryName":"VLC media player 2.0.1", 593 | "sRegistryVersion":"2.0.1", 594 | "oInstallDate":"2013-09-26T13:29:37.000Z", 595 | "nIdFile":null, 596 | "oProgram":null 597 | }, 598 | "VMware_Player":{ 599 | "sRegistryKey":"VMware_Player", 600 | "sArchitecture":"x86", 601 | "sRegistryName":"VMware Player", 602 | "sRegistryVersion":"5.0.1", 603 | "oInstallDate":"2013-01-15T12:37:07.000Z", 604 | "nIdFile":null, 605 | "oProgram":null 606 | }, 607 | "{6C9F6D23-E9AD-43C9-B43A-011562AAF876}":{ 608 | "sRegistryKey":"{6C9F6D23-E9AD-43C9-B43A-011562AAF876}", 609 | "sArchitecture":"x86", 610 | "sRegistryName":"Windows Mobile 5.0 SDK R2 for Pocket PC", 611 | "sRegistryVersion":"5.00.1700.5", 612 | "oInstallDate":"2013-01-22T13:48:04.000Z", 613 | "nIdFile":null, 614 | "oProgram":null 615 | }, 616 | "{9656F3AC-6BA9-43F0-ABED-F214B5DAB27B}":{ 617 | "sRegistryKey":"{9656F3AC-6BA9-43F0-ABED-F214B5DAB27B}", 618 | "sArchitecture":"x86", 619 | "sRegistryName":"Windows Mobile 5.0 SDK R2 for Smartphone", 620 | "sRegistryVersion":"5.00.1700.5", 621 | "oInstallDate":"2013-01-22T13:48:11.000Z", 622 | "nIdFile":null, 623 | "oProgram":null 624 | }, 625 | "{35305A6C-84BB-4E03-9D3B-719E5F958C8C}":{ 626 | "sRegistryKey":"{35305A6C-84BB-4E03-9D3B-719E5F958C8C}", 627 | "sArchitecture":"x64", 628 | "sRegistryName":"WindowsGREP", 629 | "sRegistryVersion":"2.3", 630 | "oInstallDate":"2013-01-16T07:48:16.000Z", 631 | "nIdFile":null, 632 | "oProgram":null 633 | }, 634 | "WinRAR archiver":{ 635 | "sRegistryKey":"WinRAR archiver", 636 | "sArchitecture":"x64", 637 | "sRegistryName":"WinRAR 4.11 (64-bit)", 638 | "sRegistryVersion":"4.11.0", 639 | "oInstallDate":"2013-01-15T12:31:30.000Z", 640 | "nIdFile":null, 641 | "oProgram":null 642 | }, 643 | "winscp3_is1":{ 644 | "sRegistryKey":"winscp3_is1", 645 | "sArchitecture":"x86", 646 | "sRegistryName":"WinSCP 5.1.5", 647 | "sRegistryVersion":"5.1.5", 648 | "oInstallDate":"2013-07-09T07:00:35.000Z", 649 | "nIdFile":null, 650 | "oProgram":null 651 | } 652 | }, 653 | "article_type":"news", 654 | "params":{ 655 | "type":"server_data" 656 | }, 657 | "tracking":{ 658 | "packets":[ 659 | { 660 | "sSessionId":"2761382608826459", 661 | "sExecutionId":"2561382608819", 662 | "sMachineId":"397E50FE-CB9C-48BE-9014-AA25249143D5", 663 | "sMachineUuid":"84c2988000000000000090b11c8ab322", 664 | "oApp":{ 665 | "dimensions":{ 666 | "height":689, 667 | "width":960 668 | }, 669 | "version":"1.5.3DevH" 670 | }, 671 | "nStatus":0, 672 | "oConfig":{ 673 | "aAlwaysTrackedEvents":[ 674 | "install-scarlett", 675 | "uninstall-scarlett", 676 | "application-start", 677 | "application-close", 678 | "login", 679 | "logout", 680 | "user-data-collection", 681 | "win-show-window-first-time" 682 | ] 683 | }, 684 | "oScreenDimensions":{ 685 | "height":1050, 686 | "width":1680 687 | }, 688 | "oDefaultBrowser":{ 689 | "sName":"chrome", 690 | "sLanguage":"", 691 | "sVersion":"30.0.1599.101" 692 | }, 693 | "oTimestamps":{ 694 | "server":1382608820643, 695 | "local":1382608826430 696 | }, 697 | "aStack":[ 698 | { 699 | "sId":"application-start", 700 | "nTimeStamp":1382608826459, 701 | "oData":{ 702 | "autostart":0 703 | } 704 | }, 705 | { 706 | "sId":"error-message", 707 | "nTimeStamp":1382608826651, 708 | "oData":{ 709 | "Error level":"DEBUG", 710 | "Time":"2013-10-24 12:00:26 +02:00", 711 | "Category":"InstalledProgramRunner", 712 | "Message":"Scanning result: 72 apps discovered.", 713 | "Filename url":"InstalledProgramRunner.js", 714 | "Line number":-1, 715 | "Debug info":{ 716 | 717 | } 718 | } 719 | } 720 | ], 721 | "nTimerId":3, 722 | "sCommonUserId":0, 723 | "events":{ 724 | "hydra-compatibility":{ 725 | 726 | }, 727 | "application":{ 728 | 729 | } 730 | } 731 | } 732 | ] 733 | } 734 | }, 735 | "aActions":[ 736 | { 737 | "sAction":"installed_programs", 738 | "aInputList":[ 739 | "user_apps" 740 | ] 741 | }, 742 | { 743 | "sAction":"uptodate", 744 | "aInputList":[ 745 | "user_apps", 746 | "output:installed_programs:matched_user_apps" 747 | ] 748 | }, 749 | { 750 | "sAction":"news", 751 | "aInputList":[ 752 | "article_type" 753 | ] 754 | }, 755 | { 756 | "sAction":"get_programs", 757 | "aInputList":[ 758 | "params" 759 | ] 760 | }, 761 | { 762 | "sAction":"tracking", 763 | "aInputList":[ 764 | "tracking" 765 | ] 766 | } 767 | ] 768 | }; --------------------------------------------------------------------------------