protojson

package
v1.54.2 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 2 Imported by: 6 modules, 9 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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