传递动态对象
Passing dynamic objects
php 项目中有一组对象。我将他们表示为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
}
}
如何将这些对象包装在 proto
中?
要在 Protocol Buffers 中存储任意 JSON,您可以使用 google.protobuf.Value
,来自 struct.proto。在每种语言中,都有一种将 JSON 转换为 protobuf 的方法,使用这种类型,您可以处理任意 JSON.
php 项目中有一组对象。我将他们表示为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
}
}
如何将这些对象包装在 proto
中?
要在 Protocol Buffers 中存储任意 JSON,您可以使用 google.protobuf.Value
,来自 struct.proto。在每种语言中,都有一种将 JSON 转换为 protobuf 的方法,使用这种类型,您可以处理任意 JSON.