How do maps work in Protocol Buffers and how are they represented on the wire?

Last updated 8 July 2026

  • A map<K, V> is syntactic sugar: on the wire it is identical to a repeated message of entries with key = 1 and value = 2.

  • Keys must be integral or string types (no float, bytes, or messages). Values can be any type except another map.

  • Entry order is unspecified (non-deterministic serialization) and duplicate keys resolve as last-one-wins.

  • https://protobuf.dev/programming-guides/proto3/
  • https://kreya.app/blog/protocolbuffers-wire-format-part-2/
All gRPC interview questions