views:

89

answers:

2

Hey,

I'm building an iPhone app that's going to be sending and receiving large amounts of data to and from a server. I'm using JSon to get the data. I was wondering if it's possible to also use some sort of compression on the received data in order to try to speed up the process a little bit. If so, which kind of compression works best with JSon, and where can I find more info on it?

Thanks,

A: 

IPhone supports ZLib. But I think its better idea to have your server supporting compression as the NSURLRequest accepts gzip encoding from server responses. As JSON is serializable, this might be the best option for you.

With zlib you can use compression from the client-side.

Shyam
A: 

JSON itself doesn't really care what kind of compression you use on your data so you are free to choose the compression scheme that best fits the data and provides the best size/performance.

However JSON expects all data to be in UTF-8 format so you need to encode the compressed data, e.g. by using base64 encoding.

Claus Broch