ubjson / universal-binary-json-java

Universal Binary JSON Java Library
http://ubjson.org
Apache License 2.0
33 stars 4 forks source link

UBJOutputStream does not implement writing of Object Container #5

Closed Pyrolistical closed 9 years ago

Pyrolistical commented 9 years ago

According to the readme UBJOutputStream implements draft 8 of the spec, but that appears to be a lie.

I expected a method like UBJOutputStream.write(org.json.JSONObject) or UBJOutputStream.write(java.util.Map)

The closest I found was UBJOutputStream.writeObjectHeader(int), which is just wrong. The spec does not require the count of the fields in the object to be provided. Looking at the code it gets even more wrong. It writes the container type as O, when is should be {

The readme needs to be updated to let people know this is an incomplete work-in-progress.

ghost commented 9 years ago

The comments aren't wrong - the Java API does implement Draft 8, but the spec has changed (for the better) since then - we are currently on Draft 12.

The Java APIs would need to be updated to reflect these new changes.

Closing as many things are currently out of date with the Java Impl that would need to get addressed.

Pyrolistical commented 9 years ago

Ok cool. It was not obvious which spec the Java API was trying to implement. I would love to see a draft 12 implementation. ubjson has a far better philosophy than BSON and would like to see a real Java implementation for it.

dmitry-ra commented 9 years ago

Today 'ubjson-test-suite' is an example of draft12 implementation (closest implementation as I know). https://github.com/dmitry-ra/ubjson-test-suite

But now it only for playing around with specification in a browser (javascript implementation). http://dmitry-ra.github.io/ubjson-test-suite/json-converter.html#{%22arr%22:[1,2.5,3]}

Production level libraries don't exists because a "draft" status of specification. Specification is "shaking" and peoples don't want rewrite the codebase for any movement.