Skip to content

An Objective-C framework for decoding BSON binary data

Notifications You must be signed in to change notification settings

wallneradam/BSONKit

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#BSONKit

The BSONKit is an Objective-C framework for decoding binary JSON according to the BSON specification http://bsonspec.org

This is a modification of the original BSONKit created by Mattias Levin: https://github.com/mattiaslevin/BSONKit I made a lot of bug fixes and cleanups. This is tested on iOS, but should work on Os-X as well.

It doesn't use ARC, but could be easily converted to use it.

####Type conversion rules

BSON types are converted into Objective-C types according to the table below:

BSON typeObjective-c type
DocumentNSDictionary
Floating pointdouble
UTF-8 stringNSString
ArrayNSArray
Binary dataNSData
ObjectIdNSData
BooleanBOOL
UTC datestamplong long
Null valueNSNill
Regular expressionNSArray with two objects - regexp pattern (NSString) and options (NSString)
Javascript codeNSString
SymbolNSString
Javascript code with scopeNSArray with two objects - the Javascript code (NSString) and scope variables (NSDictionary)
32-bit integerNSInteger
Timestamplong long
64-bit integerlong long
Min keyTBD
Max keyTBD

##Interface

The interface for performing the decoding is very simple:

// Get a decoder instance
+ (id)decoder;
// Start decoding a BSON byte array
- (id)decode:(NSData*)source withError:(NSError**)error;

There is also a convenience NSData category:

// Decoding a BSON byte array
- (id)decodeBSONWithError:(NSError**)error;

About

An Objective-C framework for decoding BSON binary data

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 100.0%