protojson

package
v1.46.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(m proto.Message) string

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 Marshal

func Marshal(m proto.Message) ([]byte, error)

Marshal writes the given proto.Message in JSON format using permissive options that avoid errors due to schema drift. 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 Unmarshal

func Unmarshal(b []byte, m proto.Message) error

Unmarshal reads the given []byte into the given proto.Message using permissive options that avoid errors due to schema drift. The provided message must be mutable (e.g., a non-nil pointer to a message).

Types

type MarshalOptions

type MarshalOptions = protojson.MarshalOptions

type UnmarshalOptions

type UnmarshalOptions = protojson.UnmarshalOptions

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL