Skip to content

Latest commit

 

History

History
45 lines (29 loc) · 1.59 KB

README.md

File metadata and controls

45 lines (29 loc) · 1.59 KB

CBOR

CI

Concise Binary Object Representation (CBOR) is a binary data serialization format. CBOR is based on the JSON data model: a number of primitive types (integers, floats, booleans, strings and null), lists and maps (which represent objects or structures). Being binary, CBOR is more efficient than JSON, which is text based. CBOR also supports binary data and optional extensions (called tags). This implementation has native support for string and epoch based timestamps (DateAndTime) and big integers (Integer).

This project contains encoding/decoding support for the half-precision, IEEE 754 16-bit (binary16) floating-point format.

Examples

(CBORReader on: (ByteArray readHexFrom: 'a201020304') readStream) next.

CBORReader decode: #[162 1 2 3 4].

ByteArray streamContents: [ :out | (CBORWriter on: out) nextPut: { 1 -> 2. 3 -> 4 } asDictionary ].

CBORWriter encode: { 1 -> 2. 3 -> 4 } asOrderedDictionary.

References

Installation

This is a Pharo Smalltalk project using the Tonel source code format.

In Pharo 11 and up you can use Iceberg to load this project.

You can also load using the following expression:

Metacello new
  baseline: 'CBOR';
  repository: 'github://svenvc/CBOR:main';
  load.

Written and supported by Sven Van Caekenberghe. MIT Licensed.