Binary encoding with support for length-prefixed arrays