IPhone, JSon and compression

I am creating an application for the iPhone that will send and receive large amounts of data to and from the server. I use JSon to get data. I was wondering if you can also use some kind of compression of the received data to speed up the process a bit. If so, what compression works best with JSon, and where can I find more information about this?

Thanks,

+6
json iphone compression
source share
5 answers

late for the party, but just in case someone is looking. Use ASIHTTPRequest, which has built-in gzip compression support. this will save overhead on decompression processing. gzip in ASIHTTPRequest

+2
source share

The iPhone supports ZLib. But I think its best idea for your server to support compression, as NSURLRequest accepts gzip encoding from server responses. Since JSON is serializable, this might be the best option for you.

With zlib you can use client-side compression.

0
source share

JSON doesn't really care about what kind of compression you use for your data, so you can choose the compression scheme that best matches the data and provides the best size / performance.

However, JSON expects all data to be in UTF-8 format, so you will need to encode compressed data, for example. using base64 encoding.

0
source share

There are at least two algorithms used to compress JSON (CJson and HPack).

If the client device supports gzip, then there is no benefit in using JSON compression. When using both gzip compression and json compression, the improvement is negligible. Using JSON compression makes sense when gzip is disabled or not supported.

0
source share

I think that the HPack compression algorithm (also known as JSONH) with gzip compression is a good option if you are too concerned about the size of the data. I tried to compress simple json data with an array of objects, I used two compression methods -

  • Gzip
  • JSONH + GZIP

The result of JSONH + gzip was about 7% more compressed than the result of using gzip. In my case, it was a significant number, and I continued with a mixed implementation.

0
source share

All Articles