Skip to content

Encoding & Normalization

Wesley Miaw edited this page Jul 15, 2016 · 3 revisions

MSL message data structures are defined using JSON Type Notation. There is no one specific encoding format used to represent MSL message data structures. Any encoding format compatible with JSON Type Notation is acceptable.

Application data carried within MSL messages are treated as binary data even if the data may in fact be text. Applications may choose their own binary encoding and normalization forms (if any) for application data that is text.

Encoding Formats

When a MSL message data structure is encoded, the first byte of the encoding is used to identify the format.

The following encoding formats are defined.

JSON Encoding

MSL message data structures are represented as JSON objects and are encoded as Unicode text strings. Binary data is Base64 encoded. When constructing or parsing text strings Unicode Normalization Form C (NFC) of canonical decomposition followed by canonical composition must be used. This is the default form used by JavaScriptCore. The text will then be encoded into binary as UTF-8.

The first byte of a JSON object encoding is the left curly brace character ‘{’. This byte also marks the opening brace of the JSON object itself.

Clone this wiki locally