4 ms·
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 ex
by rkalla 15y ago
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 15y agoYou 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 15y agoI 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.