For retrieving an element from the array, you should be able to use the current offset and the next offset (from your offset array), subtracting one (due to the separator byte) from the difference to get the length. One exception is for null - if the first character at the offset is a null byte, then you know it's null (and don't even have to look at the next offset). The other exception is when you're getting the position of the last element in the array. In this case, you know the fixed length of the header, so you can calculate the length in this case as well. Any attempts to retrieve an element past the number of elements you've serialized returns null (that's why trailing nulls do not need to be kept).

Is there a case I'm missing? You should have an offset for every array element, including null elements that are in the middle, so I think this will work.