
Universal Binary JSON Specification - niyazpk
http://ubjson.org/
======
nivertech
Just because there is no binary data type in JavaScript, doesn't mean that I
need to encode all my binary data fields using BASE64 over the wire.

Please add binary data type with the exception, that JavaScript clients will
get it as BASE64 string.

~~~
rkalla
The reason the spec does not explicitly include a binary data type is because
Smile and BJSON already do this (as well as BSON if you want to include all
the extra types it adds); none of these specifications have been widely
adopted with BSON being the most successful only because 10gen's success with
Mongo.

JSON's fast and wide adoption was due to two things: simplicity and
compatibility.

UBJSON follows both of those tenants while giving many of the advantages of a
binary format without taking them to an extreme.

Yes a binary-specific type would be helpful, but it would add an additional
vector of potential incompatibility. As would data de-duplication, but again,
would make understanding the spec and writing parsers/generators for it
considerably harder.

As I mentioned there are other JSON binary specs out there, each of them with
their own complexities or customizations that _I_ think stopped them from mass
adoption.

I hope to avoid all of those potential pitfalls with UBJSON, keeping
compatibility and simplicity (in that order) as the core requirements for the
spec.

~~~
nivertech
You didn't convinced me.

The only reason I need binary encoding for JSON, is to be able to efficiently
transfer binary fields. With UBJSON I will need to encode them as BASE64.
There are lots of libraries for BSON, so I will continue to use it, even if
it's not a pure JSON.

For mass adoption UBJSON should be implemented in browsers and also in jquery
and node.js.

~~~
rkalla
I wasn't trying to convince you; only point out that it might be the wrong
tool for the job you are trying to accomplish.

> "The only reason I need binary encoding for JSON, is to be able to
> efficiently transfer binary fields"

That isn't the goal of the UBJSON project; it is to make a 1:1 compatible,
efficient representation of JSON.

It sounds like you already have BSON working in every way you need it to
though, so that is good news.

As for UBJSON implementations, there is already a Node.js implementation and
as for in-browser support, I am specifically waiting for native binary data
support in JavaScript (don't have the spec link handy) and then it will be
possible.

I do appreciate the feedback though; knowing how people are wanting to use the
spec or problems they are trying to solve is important and you gave me a good
data point to consider.

------
ZenPsycho
what material advantage does this have over the extremely similar and yet more
firmly established OSC protocol, I wonder.

