Skip to content

Latest commit

 

History

History
43 lines (34 loc) · 1.61 KB

README.md

File metadata and controls

43 lines (34 loc) · 1.61 KB

#BSONKit

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

####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;