CARVIEW |
Select Language
HTTP/2 301
content-type: text/html; charset=utf-8
location: https://protobuf.dev
cache-control: private, max-age=2592000
pragma:
vary: Cookie
vary: Accept-Encoding
content-security-policy: base-uri 'self'; object-src 'none'; script-src 'strict-dynamic' 'unsafe-inline' https: http: 'nonce-+n/wBHEHdNUyFA7vJGxjd+3NXlAI9h' 'unsafe-eval'; frame-ancestors 'self' https://code-assist-free-tier-autopush.corp.google.com https://code-assist-free-tier-staging.corp.google.com https://code-assist-free-tier.corp.google.com https://*.proxy.googlers.com; report-uri https://csp.withgoogle.com/csp/devsite/v2
strict-transport-security: max-age=63072000; includeSubdomains; preload
x-xss-protection: 0
x-content-type-options: nosniff
expires: 0
content-encoding: gzip
x-cloud-trace-context: a237c384869a62a239775fb23f8a2121
date: Thu, 17 Jul 2025 16:25:00 GMT
server: Google Frontend
content-length: 173
alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
HTTP/2 200
server: GitHub.com
content-type: text/html; charset=utf-8
last-modified: Fri, 11 Jul 2025 16:25:23 GMT
access-control-allow-origin: *
strict-transport-security: max-age=31556952
etag: W/"68713af3-c165"
expires: Thu, 17 Jul 2025 15:51:34 GMT
cache-control: max-age=600
content-encoding: gzip
x-proxy-cache: MISS
x-github-request-id: 14AD:BC9A1:9C6D6:B53B9:687919AD
accept-ranges: bytes
age: 0
date: Thu, 17 Jul 2025 16:25:01 GMT
via: 1.1 varnish
x-served-by: cache-bom4737-BOM
x-cache: HIT
x-cache-hits: 0
x-timer: S1752769501.882803,VS0,VE208
vary: Accept-Encoding
x-fastly-request-id: ce1e7e397583e3325eaf3f82b2b6b27080c8a5b2
content-length: 7641
Protocol Buffers Documentation
Protocol Buffers
Protocol Buffers are language-neutral, platform-neutral extensible mechanisms for serializing structured data.
What Are Protocol Buffers?
Protocol buffers are Google’s language-neutral, platform-neutral, extensible 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.
Pick Your Favorite Language
Protocol buffers support generated code in C++, C#, Dart, Go, Java, Kotlin, Objective-C, Python, and Ruby. With proto3, you can also work with PHP.
Example Implementation
edition = "2023";
message Person {
string name = 1;
int32 id = 2;
string email = 3;
}
Figure 1. A proto definition.
// Java code
Person john = Person.newBuilder()
.setId(1234)
.setName("John Doe")
.setEmail("jdoe@example.com")
.build();
output = new FileOutputStream(args[0]);
john.writeTo(output);
Figure 2. Using a generated class to persist data.
// C++ code
Person john;
fstream input(argv[1],
ios::in | ios::binary);
john.ParseFromIstream(&input);
id = john.id();
name = john.name();
email = john.email();
Figure 3. Using a generated class to parse persisted data.
How Do I Start?
- Download and install the protocol buffer compiler.
- Read the overview.
- Try the tutorial for your chosen language.