u8array_to_object


u8array_to_object(bytes, @optional decoder = identity)
      

Return an object de-serialized from the byte array bytes.

The optional decoder parameter is a function that take a single argument. As the de-serializer walks through bytes, it calls decoder on each sub-object that is encountered. The decoder is used to perform custom transformations on the sub-objects and thereby support custom encodings.

Examples:


let e = object_to_u8array([1, "hi", 3])
u8array_to_object(e)
// [1, hi, 3]

function f(x) x * 100
e = object_to_u8array(f)
u8array_to_object(e)(10)
// 1000
      

Also see:

byte_array_reader


Core Module Index | Contents