const defaultIndent … // 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. Its output will change across // different builds of your program, even when using the same version of the // protobuf module. func Format(m proto.Message) string { … } // Marshal writes the given [proto.Message] in JSON format using default options. // Do not depend on the output being stable. Its output will change across // different builds of your program, even when using the same version of the // protobuf module. func Marshal(m proto.Message) ([]byte, error) { … } type MarshalOptions … // 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. Its output will change across // different builds of your program, even when using the same version of the // protobuf module. func (o MarshalOptions) Format(m proto.Message) string { … } // Marshal marshals the given [proto.Message] in the JSON format using options in // Do not depend on the output being stable. Its output will change across // different builds of your program, even when using the same version of the // protobuf module. func (o MarshalOptions) Marshal(m proto.Message) ([]byte, error) { … } // MarshalAppend appends the JSON format encoding of m to b, // returning the result. func (o MarshalOptions) MarshalAppend(b []byte, m proto.Message) ([]byte, error) { … } // marshal is a centralized function that all marshal operations go through. // For profiling purposes, avoid changing the name of this function or // introducing other code paths for marshal that do not go through this. func (o MarshalOptions) marshal(b []byte, m proto.Message) ([]byte, error) { … } type encoder … var typeFieldDesc … type typeURLFieldRanger … func (m typeURLFieldRanger) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { … } type unpopulatedFieldRanger … func (m unpopulatedFieldRanger) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { … } // marshalMessage marshals the fields in the given protoreflect.Message. // If the typeURL is non-empty, then a synthetic "@type" field is injected // containing the URL as the value. func (e encoder) marshalMessage(m protoreflect.Message, typeURL string) error { … } // marshalValue marshals the given protoreflect.Value. func (e encoder) marshalValue(val protoreflect.Value, fd protoreflect.FieldDescriptor) error { … } // marshalSingular marshals the given non-repeated field value. This includes // all scalar types, enums, messages, and groups. func (e encoder) marshalSingular(val protoreflect.Value, fd protoreflect.FieldDescriptor) error { … } // marshalList marshals the given protoreflect.List. func (e encoder) marshalList(list protoreflect.List, fd protoreflect.FieldDescriptor) error { … } // marshalMap marshals given protoreflect.Map. func (e encoder) marshalMap(mmap protoreflect.Map, fd protoreflect.FieldDescriptor) error { … }