Library tison

To use this library in your code:

import encoding.tison
The encoding format TISON is a binary encoded JSON variant similar to UBJSON. It is natively supported by the Toit virtual machine and is fast to encode to and decode from.

Functions

decode data/Data -> any
Decodes the given data.
The result is null or an instance of int, bool, float, string, ByteArray, List, or Map. The list elements and map values will also be one of these types.

encode object/any -> ByteArray
Encodes the object as a TISON ByteArray.
The object must be a supported type, which means an instance of int, bool, float, string, ByteArray, List or Map. The elements of lists and the values of maps can be any of the supported types.
For compatibility with JSON encoding, you should avoid passing byte arrays directly or indirectly to encode.
For compatibility with JSON and UBJSON encodings, you should avoid passing maps with non-string keys directly or indirectly to encode.
Cannot encode data structures with cycles in them. In this case it will throw "NESTING_TOO_DEEP".