1

Analyzing quick guides I was able to understand how to set up the protocol buffers to send/receive objects already known by client and server.

My doubt is how to send or receive an entire JSON file, even when I dont know its properties and types. There's a way to do that?

On the proto3 documentation theres no such type as "JSON".

https://developers.google.com/protocol-buffers/docs/proto3

2 Answers2

1

I believe the "Any" type is what you are looking for. Also look into mapping, and JSON mapping. It is there in the documentation you posted.

Espen
  • 2,456
  • 1
  • 16
  • 25
0

The google.protobuf.Struct type is the common solution for representing arbitrary JSON structures in Protobuf. It uses a map field to support arbitrary field names, and the google.protobuf.Value type uses a oneof field to support arbitrary value types, including nested Struct values.

murgatroid99
  • 19,007
  • 10
  • 60
  • 95