jsonutil

package
v0.0.0-...-c1f61f0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2025 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var JSONPBMarshaller = &jsonpb.Marshaler{
	EmitDefaults: true,
}

JSONPBMarshaller marshals protobufs as JSON.

View Source
var JSONPBUnmarshaller = jsonpb.Unmarshaler{
	AllowUnknownFields: true,
}

JSONPBUnmarshaller unmarshals JSON and creates corresponding protobufs.

Functions

func ParseJSONProto

func ParseJSONProto(in []byte, msg proto.Message) ([]proto.Message, error)

ParseJSONProto takes an input string and a proto message indicating the type of message and parses either a single object or an array of objects. It always returns an array, which will be a singleton array if exactly one item was passed.

The parameter msg is treated as a template only. We *always* clone it defensively before reading into it.

Types

This section is empty.

Jump to

Keyboard shortcuts

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