Simple examples on how to use.

89 views
Skip to first unread message

Siavash Bonakdar

unread,
Oct 14, 2015, 8:28:10 PM10/14/15
to Universal Binary JSON (UBJSON)
Hi, I am looking to implement ubjson in an android SDK.
I have successfully imported the ubjson library into my project, but I have no idea what to do next. There are no examples or instruction on the site.
From what I can see, none of the methods or constructors take in JSON objects as a parameter, so how does one convert JSON to UBJSON, given a JSONObject or JSONArray?

Siavash Bonakdar

unread,
Oct 14, 2015, 8:34:21 PM10/14/15
to Universal Binary JSON (UBJSON)
I would also be fine with an example of converting a JSON string into UBJSON.

Riyad Kalla

unread,
Oct 15, 2015, 1:17:29 AM10/15/15
to Siavash Bonakdar, Universal Binary JSON (UBJSON)

Siavash,

The Java libraries don’t current support the latest Draft specification as I haven’t had time to maintain them – so higher level supporting operations (like taking an Android-specific JSON object, passing it to UBJSON lib and getting out a binary representation) was never developed into the existing libs.

--
You received this message because you are subscribed to the Google Groups "Universal Binary JSON (UBJSON)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to universal-binary...@googlegroups.com.
To post to this group, send email to universal-...@googlegroups.com.
Visit this group at http://groups.google.com/group/universal-binary-json.
For more options, visit https://groups.google.com/d/optout.

 

 

Siavash Bonakdar

unread,
Oct 15, 2015, 1:26:30 PM10/15/15
to Universal Binary JSON (UBJSON), siav...@gmail.com
Thanks for the fast reply!
What about examples in just pure Java, or even other languages so that I can implement my own?

Riyad Kalla

unread,
Oct 15, 2015, 3:20:26 PM10/15/15
to Universal Binary JSON (UBJSON)
All the libraries provide examples of how to read and write UBJSON fundamentally - so you could look at the Java code to see how to write an Array for example and then when you are iterating through your JSON object, an encountered an Array, you would know how to write it out (for example).

Phrased another way, all the building blocks are there, they just aren't wired together beautifully such that you can provide an Object and Boom, magic happens. Atleast in the Java impl, but the code is beautiful and easy to follow... :)

On Thu, Oct 15, 2015 at 10:26 AM, Siavash Bonakdar <siav...@gmail.com> wrote:
Thanks for the fast reply!
What about examples in just pure Java, or even other languages so that I can implement my own?

--

Siavash Bonakdar

unread,
Oct 15, 2015, 6:54:21 PM10/15/15
to Universal Binary JSON (UBJSON)
Ok thanks, I didnt realize the examples were in Library itself.
Now that I've seen the examples, I have a better question:
From what I can see, there are two ways to convert an object into ubjson and back, using the ObjectWriter/Reader class, and writing a custom serilize/deserializer for each object.
Am I understanding the code correctly, or are those things achieving different things? 
Reply all
Reply to author
Forward
0 new messages