1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package protojson
import (
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/proto"
)
type MarshalOptions = protojson.MarshalOptions
type UnmarshalOptions = protojson.UnmarshalOptions
// 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 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 Marshal(m proto.Message) ([]byte, 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).
func Unmarshal(b []byte, m proto.Message) error