GithubHelp home page GithubHelp logo

jsonpack's Issues

Asynchronous Packing and Unpacking

Given that a major use case of such a tool is to decrease the time spent downloading a large file, instead spending that time decoding that file, it would seem appropriate that the unpack function be asynchronous. e.g. that it interrupts itself occasionally to let the browser run (using a settimeout callback, perhaps one that calls back to itself right at the beginning of each recursion of recursiveUnpackerParser) and allows its progress to be externally tracked (perhaps by allowing the user to set an onprogress event listener). Perhaps this would not necessarily always need to be the default behavior, but it should be an option.

can't import via bower

I just did a bower install sapienlab/jsonpack and included main.js in my build. I get:

Uncaught Error: Cannot find module 'function (define) {
<snip all code from main.js>

What's causing that?

Unpacking issue with IE

Hi,
We are facing issue with upack ok IE browser. While unpacking its using for..in loop , for...in looks at the array as an object, and therefore properties like indexOf or length may be included in the loop, and failing to decode in IE.

TODO: Adding some tests

Hello, tomorrow I'll add some tests using mocha and Travis to monitor. If anyone has any suggestions on another stack test as Jasmine or theintern.io please let me know;)

Can not distinguish JSON string and JSON object

var data = { x: 1234 };
var str = JSON.stringify(data);

jsonpack.unpack(jsonpack.pack( data ))
// returns an object { "x": 1234 }

jsonpack.unpack(jsonpack.pack( str ))
// returns an object { "x": 1234 }
// expected return value: a string  "{ \"x\": 1234 }"

Timestamps/Date not working?

It looks that jsonpack doesn't work with Date objects

expected:
"created_at": "2019-10-20T17:36:29.034Z",

got
"created_at": {}

A review

A review of this repository must be done. Any help in performance tests will be welcome :)

Packing array that is not instance of Array results in a object

Having an array which is not instance of Array object is resulting in packing the value as object.

Here is inspection of the value from IDE:
Screenshot 2021-04-09 at 10 28 36

And packed result is:
Screenshot 2021-04-09 at 10 28 44

it is probably due to some clone operation before packing, but still array check should work ok.

I will submit a PR with the correct check.

Suggestion: using zlib deflate dictionary to compress json data

Since zlib can use preset dictionary (http://www.zlib.org/rfc-zlib.html), we can make use of it for better json data compress.
The steps are:

  1. travel object tree and found out most frequent terms (more than 10 times, for example)
  2. set those term as deflate's preset dictionary
  3. JSON.stringify -> deflate(with preset dictionary) (-> base64, if binary is not acceptable)

The beauty of this solution is, it's a standard gzip + json compress method which can also rich same compress rate of jsonpack.

Your cpm link is dead

In your readme, it links to your clone of CPM but this appears to be a dead link. Maybe update the link to an available one instead?

Other Languages

Are there any implementations in other languages? We'd like to maintain compatibility across code bases, and I haven't been able to find any other implementations. C#, Java, etc.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.