json

package
v4.1.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisallowUnknownFields

func DisallowUnknownFields(d *json.Decoder) *json.Decoder

DisallowUnknownFields configures the JSON decoder to error out if unknown fields come along, instead of dropping them by default.

func Fix

func Fix(s string) string

func IsJSON

func IsJSON(j []byte) bool

IsJSON tests whether or not the suppied byte array is valid JSON

func Jsonify

func Jsonify(v any) (map[string]any, error)

func Unmarshal

func Unmarshal(j []byte, o any, opts ...Opt) error

Unmarshal is a convenience wrapper around json.Unmarshal to support json decode options

func UnmarshalStrict

func UnmarshalStrict(j []byte, o any) error

UnmarshalStrict is a convenience wrapper around json.Unmarshal with strict unmarshal options

Types

type Marshaler

type Marshaler struct{}

Marshaler is a type which satisfies the grpc-gateway Marshaler interface

func (*Marshaler) ContentType

func (j *Marshaler) ContentType() string

ContentType implements gwruntime.Marshaler.

func (*Marshaler) Marshal

func (j *Marshaler) Marshal(v any) ([]byte, error)

Marshal implements gwruntime.Marshaler.

func (*Marshaler) NewDecoder

func (j *Marshaler) NewDecoder(r io.Reader) gwruntime.Decoder

NewDecoder implements gwruntime.Marshaler.

func (*Marshaler) NewEncoder

func (j *Marshaler) NewEncoder(w io.Writer) gwruntime.Encoder

NewEncoder implements gwruntime.Marshaler.

func (*Marshaler) Unmarshal

func (j *Marshaler) Unmarshal(data []byte, v any) error

Unmarshal implements gwruntime.Marshaler.

type Opt

type Opt func(*json.Decoder) *json.Decoder

Opt is a decoding option for decoding from JSON format.

Jump to

Keyboard shortcuts

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