Tutorial details

BSON – What, why, how? | App Code for Sale | Preview

BSON – What, why, how? | iOS Tutorial

BSON is often referred as Binary JSON. BSON is the serialization of JSON-like objects that are binary encoded.

Overview PAGE TOP

BSON is often referred as Binary JSON. BSON is the serialization of JSON-like objects that are binary encoded. Just like JSON, BSON also supports nested objects, arrays, strings, integers etc. BSON supports some more data types, especially raw binary data. So we can consider BSON as a super-set of JSON.BSON is designed to be fast to transport and fast to decode. The main features of BSON are:

  • Traversable
  • Light weight and
  • Efficient

Lets stop lecturing about BSON and move on to discussion regarding BSON decoding and integrating it to objC project.We will make use of Martin Kou’s Bson Decode library for this purpose. Get the files along with the binary I created for your ease from https://github.com/deepukjayan/BSON.Add these files to your project:

BSON_1.jpg

Now add the required flags for these files:

BSON2.jpg

The binary we added will be already listed. We will have to change it to “Optional” to avoid the error when running in iPhone simulator.

BSON3.jpg

Thats it. You are all set to decode some BSON.Import ”BSONCodec.h” to where ever use need to decode BSON.With this wrapper, BSON decoding is as simple as a you alloc a new NSDictionary.

myDict =  [myBsonRecieved BSONValue];

Lets see what to do if we need to encode something to BSON.Just like you decoded the BSON, simply call

bsonDataToSend = [myDict BSONEncode];

Hope that helps.

Reference PAGE TOP

BSON – What, why, how? from http://ios-blog.co.uk

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.

80x15.png

0 Comments Leave a comment

Please login in order to leave a comment.

Newest first
!

Sign-in to your Chupamobile Account.

The Easiest way to Launch your next App or Game.

Join Chupamobile and get instant access to thousands of ready made App and Game Templates.

Creating an account means you’re okay with Chupamobile’s Terms of Service and Privacy Policy.