format_packet() and decode_packet() handle singleton data, strings, varints, and arrays