quantum_well
quantum_well

Reputation: 979

How serialized protobuf text format looks like?

Given the following proto file

syntax = "proto3";

package tutorial;

message MyMessage {
    string my_value = 1;
}

How the corresponding serialized text file should look like?

my_value : "abc"

or

MyMessage {
    my_value : "abc"
}

Upvotes: 1

Views: 559

Answers (1)

Marc Gravell
Marc Gravell

Reputation: 1063944

Neither. There are two data formats found in protobuf; the more common is the binary protobuf format; the second (and rarer) is an opinionated JSON variant. So; if we assume that you're talking about the JSON version, we would expect valid JSON (note that I'm not accounting for whitespace here) similar to:

{
    "my_value" : "abc"
}

Upvotes: 1

Related Questions