A CoffeeScript Implementation of BJSON for Browsers
BJSON is a binary JSON encoding, essentially maintaining the same structure as JSON, but with support for embedding binary blobs.
You can encode any JSON document in BJSON and must BJSON documents in JSON.
However, encoding binary data, such as images, is not supported by
and methods typically used for encoding binary data in JSON have a large overhead.
With BJSON you can serialize JSON objects containing typed arrays (
to binary data. Futhermore, a BJSON encoding is typically 5-10% shorter than the
conventional string encoding of JSON objects.
For more information on BJSON and BJSON.coffee, take a look at the following links.
- The BJSON specification
- The BJSON.coffee browser compatibility testing page
- My blog post introducing BJSON.coffee
- Performance comparison of JSON.stringify and BJSON.serialize
BJSON.coffee is released under the Apache License 2.0.
For UTF-8 string encoding BJSON.coffee uses
encoding.js which is a modified version of the string
encoding shim provided by stringencoding, which is also
licensed under the Apache License 2.0.