protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

Support unknown Any types in JSON serialization

Open lizan opened this issue 6 years ago • 1 comments

What language does this apply to? C++

Describe the problem you are trying to solve. Having an unknown type in Any (including cases embedded Any in other message) will result MessageToJsonString fail with unknown type.

Describe the solution you'd like Have an option in JsonPrintOptions, to serialize unknown Any as {"type_url": "type.googleapis.com/FQTypeName", "value": "<base64 encoded binary serialized proto>"}, similar to what text format does.

Describe alternatives you've considered

Additional context This is useful in Envoy (https://github.com/envoyproxy/envoy) context we might have Any in logging object which is serialized by WebAssembly. Also to make sure Envoy can dump config with unknown typed config for extensions.

lizan avatar Dec 07 '19 00:12 lizan

We don't want options. Serialize it always, or always don't. There is no option.

elharo avatar Sep 13 '21 12:09 elharo

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.

This issue is labeled inactive because the last activity was over 90 days ago.

github-actions[bot] avatar Mar 29 '24 10:03 github-actions[bot]

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it.

This issue was closed and archived because there has been no new activity in the 14 days since the inactive label was added.

github-actions[bot] avatar Apr 13 '24 10:04 github-actions[bot]