srvr4vr
srvr4vr

Reputation: 193

Passing dynamic objects

There is a set of objects in a php project. I will represent them as JSON

{
  "name" : "foo",
  "type" : "bar",
  "context" : {
      //There is an arbitrary set of fields in which there can be integers, float, string, bool, as well as dictionaries and arrays
  }
}

How I can wrap this objects in proto?

Upvotes: 1

Views: 1440

Answers (1)

Eric Anderson
Eric Anderson

Reputation: 26394

To store arbitrary JSON in Protocol Buffers, you can use google.protobuf.Value, from struct.proto. In each language there's a way to convert JSON into protobuf, and with this type you can handle arbitrary JSON.

Upvotes: 3

Related Questions