Currently I send JSON from an Ajax post to the server which is then converted to objects using the Jackson Mapper.
The format is like this
{"id":"780710","folderID":"42024","displayOrder":2},{"id":"780724","folderID":"42024","displayOrder":3}
What is the best JavaScript library to compress this data and will the Jackson mapper be able to handle the new format?
JsonZipper is also Awesome for multiple similar repeated objects. It allows you to use an object in its' zipped state by only extracting one object by index from the array, so memory wise it is great as it will always only have extracted what you want.
Oh and you can actually compress on the go, so basically as you are generating data objects, you can compress them, leaving you to always have a small memory footprint.
Most other compression algorithms have to compress&extract all the data at once.
Note however: if your data is a Homogeneous Collection (Exactly Same keys then hpack will be better.)
As said by @JamWaffles, this is the best JSON is able to do concerning compression. And in your case (the line of code you delivered), compressing further may be overkill.
But if you have larger responses, and you want to save those bytes, have a look at
or
They are not JSON, but they serialize data to a smaller format (in most cases).
Why not just enable gzip compression that browser and web servers support? This will very nicely compress data sizes, with very little explicit work.
According to this tweet by modec, compressing JSON is indeed possible, and provides better result than tested alternatives.
It's possible to handle JSON format with nodejs, and a recent open-source project just implemented a very fast compression algorithm for nodejs.
You can use e.g. jsonh, successor of hpack which has benchmarks on web-resource-optimization. It helps, but the same site will also show you that gzip alone will probably be enough.
So to be clear, gzip works better than hpack, but combining them adds a little more compression.