Help us shape the future of Go! Take the 2026 Go Developer Survey

json

package
v4.1.6 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 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 added in v4.1.0

type Marshaler struct{}

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

func (*Marshaler) ContentType added in v4.1.0

func (j *Marshaler) ContentType() string

ContentType implements gwruntime.Marshaler.

func (*Marshaler) Marshal added in v4.1.0

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

Marshal implements gwruntime.Marshaler.

func (*Marshaler) NewDecoder added in v4.1.0

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

NewDecoder implements gwruntime.Marshaler.

func (*Marshaler) NewEncoder added in v4.1.0

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

NewEncoder implements gwruntime.Marshaler.

func (*Marshaler) Unmarshal added in v4.1.0

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

Unmarshal implements gwruntime.Marshaler.

type Opt added in v4.1.0

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