views:

203

answers:

1

I'm successfully using yajl-objc along with ASIHTTPRequest in an iPhone project that does network access and pulls down and parses JSON data. ASIHTTPRequest allows gzipped HTTP responses by default, which is great, but I'm using the streaming parser ability of YAJL and it rightfully chokes on gzipped data. I can wait until the HTTP request has finished then un-gzip and parse the response, but I'm going for speed here and would like to parse the gzipped data as it downloads.

Is it possible to un-gzip data on the fly, parse the JSON within, then forget about that chunk of gzipped data?

If this last part could be solved, this setup seems like it would make for a great system:

  • YAJL is one of the fastest JSON parsers around
  • ASIHTTPRequest is easy and asynchronous
  • Response bodies could be gzipped, saving on-the-wire traffic
  • JSON could be parsed without loading the whole tree into constrained device memory

Any guidance would be greatly appreciated!