Should I move big data blobs in JSON or in separate binary connection?

Posted by Amagrammer on Stack Overflow See other posts from Stack Overflow or by Amagrammer
Published on 2010-04-08T17:07:22Z Indexed on 2010/04/08 17:13 UTC
Read the original article Hit count: 352

Filed under:
|

QUESTION:

Is it better to send large data blobs in JSON for simplicity, or send them as binary data over a separate connection?

If the former, can you offer tips on how to optimize the JSON to minimize size?

If the latter, is it worth it to logically connect the JSON data to the binary data using an identifier that appears in both, e.g., as "data" : "< unique identifier >" in the JSON and with the first bytes of the data blob being < unique identifier > ?

CONTEXT:

My iPhone application needs to receive JSON data over the 3G network. This means that I need to think seriously about efficiency of data transfer, as well as the load on the CPU.

Most of the data transfers will be relatively small packets of text data for which JSON is a natural format and for which there is no point in worrying much about efficiency.

However, some of the most critical transfers will be big blobs of binary data -- definitely at least 100 kilobytes of data, and possibly closer to 1 megabyte as customers accumulate a longer history with the product. (Note: I will be caching what I can on the iPhone itself, but the data still has to be transferred at least once.) It is NOT streaming data.

I will probably use a third-party JSON SDK -- the one I am using during development is here.

Thanks

© Stack Overflow or respective owner

Related posts about JSON

Related posts about blobs