Protocol Buffers is a language-neutral and platform-neutral way of encoding structured data in an efficient yet extensible format. Google uses Protocol Buffers for almost all of its internal RPC protocols and file formats. It is also the default data encoding used by the open source gRPC framework.
Protocol buffers is a flexible, efficient, automated mechanism for serializing structured data – think XML, but smaller, faster, and simpler. You define how you want your data to be structured once, then you can use special generated source code to easily write and read your structured data to and from a variety of data streams and using a variety of languages. You can even update your data structure without breaking deployed programs that are compiled against the "old" format.
Protocol buffer compilers are capable of handling a wide range of language syntax, including C, C++, Java, Objective C, Python and PHP. This means that messages defined in proto files can be converted to equivalent properties or variables in source files belonging to these languages, and many more.
Sample definition:
message Person {
string name = 1;
int32 id = 2;
string email = 3;
enum PhoneType {
MOBILE = 0;
HOME = 1;
WORK = 2;
}
message PhoneNumber {
string number = 1;
PhoneType type = 2 [default = HOME];
}
repeated PhoneNumber phone = 4;
}
More info at the official protobuf site. The latest API version is proto3, which is pretty much similar to proto2, but has some distinct differences.