I use base64 encoding within json for arbitray binary data. Images, encrypted data, C++ POD objects (ok that one is rare)
On Mon, Aug 11, 2014 at 8:51 AM, Sergey Lyubka <[email protected]> wrote: > On Mon, Aug 11, 2014 at 1:18 PM, Jamie Vicary <[email protected]> > wrote: > >> Hi, thanks for your reply. JSON is a plain-text format, right? I would >> worry about the increased size of the data packet. >> >> Is there a platform-safe way to transmit binary data? >> > > There are plenty. > All of them transform binary data to the platform independent data using > some sort of encoding. > JSON is great cause it has relatively small overhead, and is fully human > readable. > > If you're 100% sure that sending and receiving sides are on of the same > platform, sending binary blob is an option too -- although it is still a > risky play (a software could be built with different compiler options, etc). > > If you're talking about doubles (which are 8 bytes on common > architectures), JSON-encoding might be actually even tighter then the > original array. Consider array of zeroes: JSON would be [0,0,0,...], > each number taking 2 bytes instead of 8 bytes. > > -- > You received this message because you are subscribed to the Google Groups > "mongoose-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/mongoose-users. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "mongoose-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/mongoose-users. For more options, visit https://groups.google.com/d/optout.
