Method developed by Google for serializing structured data
// Has a language-agnostic binary format syntax = "proto3" message Person { string name = 1; int32 id = 2; string email = 3; }
protoc
protoc
is a compiler code provided by Google that converts any protobuff
to target language compatible format
Schema definition is written in .proto
files
message employee { int32 id = 1; string name = 2; float salary = 3; }
= 1
) is the field's unique identifier.Instantiation
const employee = new Schema.Employee(); employee.setId(1002); employee.setName("Sam"); employee.setSalary(9000); /* JSON equivalent */ const employees = []; employees.push({ "name": "Sam", "salary": 9000, "id": 1002, });