Skip to content

JSON format of google.protobuf.Any is not following the proto protocol #1200

@ilikebasic

Description

@ilikebasic

Eg. for proto message which we want to store as goog.protobuf.Any field:

package foo.bar;
message Person {
  string first_name = 1;
  string last_name = 2;
}

Expected JSON is:

{
  "@type": "foo.bar.Person",
  "firstName": <string>,
  "lastName": <string>
}

But we get:

{
  "typeUrl": "type.googleapis.com/google.profile.Person",
  "firstName": <string>,
  "lastName": <string>
}

Notice the "typeUrl" key name instead of "@type".

This breaks interoperability between languages when using JSON.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions