package protojson

Import Path
	google.golang.org/protobuf/encoding/protojson (on go.dev)

Dependency Relation
	imports 20 packages, and imported by 2 packages

Involved Source Files decode.go Package protojson marshals and unmarshals protocol buffer messages as JSON format. It follows the guide at https://developers.google.com/protocol-buffers/docs/proto3#json. This package produces a different output than the standard "encoding/json" package, which does not operate correctly on protocol buffer messages. encode.go well_known_types.go
Package-Level Type Names (total 8, in which 2 are exported)
/* sort exporteds by: | */
MarshalOptions is a configurable JSON format marshaler. AllowPartial allows messages that have missing required fields to marshal without returning an error. If AllowPartial is false (the default), Marshal will return error if there are any missing required fields. EmitUnpopulated specifies whether to emit unpopulated fields. It does not emit unpopulated oneof fields or unpopulated extension fields. The JSON value emitted for unpopulated fields are as follows: ╔═══════╤════════════════════════════╗ ║ JSON │ Protobuf field ║ ╠═══════╪════════════════════════════╣ ║ false │ proto3 boolean fields ║ ║ 0 │ proto3 numeric fields ║ ║ "" │ proto3 string/bytes fields ║ ║ null │ proto2 scalar fields ║ ║ null │ message fields ║ ║ [] │ list fields ║ ║ {} │ map fields ║ ╚═══════╧════════════════════════════╝ Indent specifies the set of indentation characters to use in a multiline formatted output such that every entry is preceded by Indent and terminated by a newline. If non-empty, then Multiline is treated as true. Indent can only be composed of space or tab characters. Multiline specifies whether the marshaler should format the output in indented-form with every textual element on a new line. If Indent is an empty string, then an arbitrary indent is chosen. NoUnkeyedLiterals pragma.NoUnkeyedLiterals Resolver is used for looking up types when expanding google.protobuf.Any messages. If nil, this defaults to using protoregistry.GlobalTypes. UseEnumNumbers emits enum values as numbers. UseProtoNames uses proto field name instead of lowerCamelCase name in JSON field names. Format formats the message as a string. This method is only intended for human consumption and ignores errors. Do not depend on the output being stable. It may change over time across different versions of the program. Marshal marshals the given proto.Message in the JSON format using options in MarshalOptions. Do not depend on the output being stable. It may change over time across different versions of the program.
UnmarshalOptions is a configurable JSON format parser. AllowPartial accepts input for messages that will result in missing required fields. If AllowPartial is false (the default), Unmarshal will return error if there are any missing required fields. DiscardUnknown specifies whether to ignore unknown fields when parsing. An unknown field is any field whose field name or field number does not resolve to any known or extension field in the message. By default, unmarshal rejects unknown fields as an error. NoUnkeyedLiterals pragma.NoUnkeyedLiterals Resolver is used for looking up types when unmarshaling google.protobuf.Any messages or extension fields. If nil, this defaults to using protoregistry.GlobalTypes. Unmarshal reads the given []byte and populates the given proto.Message using options in the UnmarshalOptions object. It will clear the message first before setting the fields. If it returns an error, the given message may be partially set. The provided message must be mutable (e.g., a non-nil pointer to a message).
Package-Level Functions (total 17, in which 3 are exported)
Format formats the message as a multiline string. This function is only intended for human consumption and ignores errors. Do not depend on the output being stable. It may change over time across different versions of the program.
Marshal writes the given proto.Message in JSON format using default options. Do not depend on the output being stable. It may change over time across different versions of the program.
Unmarshal reads the given []byte into the given proto.Message. The provided message must be mutable (e.g., a non-nil pointer to a message).
Package-Level Variables (total 3, none are exported)
Package-Level Constants (total 5, none are exported)