Skip to content

How to set JSON options to emit fields with default values in proto3 #6035

@ganl

Description

@ganl

PHP

https://developers.google.cn/protocol-buffers/docs/proto3#json

JSON options
A proto3 JSON implementation may provide the following options:

Emit fields with default values: Fields with default values are omitted by default in proto3 JSON output. An implementation may provide an option to override this behavior and output fields with their default values.

how to set ?like:EmitDefaults or defaults_json

\Google\Protobuf\Internal\Message::existField 
……
            return $values !== $this->defaultValue($field);

Fields with default values are always omitted

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions