Use the array encode utility functions in the protocols.