json

package
v3.7.2 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2025 License: Apache-2.0 Imports: 5 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisallowUnknownFields added in v3.7.0

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 added in v3.7.0

func IsJSON(j []byte) bool

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

func Jsonify

func Jsonify(v interface{}) (map[string]interface{}, error)

func Unmarshal added in v3.7.0

func Unmarshal(j []byte, o interface{}, opts ...JSONOpt) error

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

func UnmarshalStrict added in v3.7.0

func UnmarshalStrict(j []byte, o interface{}) error

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

Types

type JSONMarshaler

type JSONMarshaler struct{}

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

func (*JSONMarshaler) ContentType

func (j *JSONMarshaler) ContentType() string

ContentType implements gwruntime.Marshaler.

func (*JSONMarshaler) Marshal

func (j *JSONMarshaler) Marshal(v interface{}) ([]byte, error)

Marshal implements gwruntime.Marshaler.

func (*JSONMarshaler) NewDecoder

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

NewDecoder implements gwruntime.Marshaler.

func (*JSONMarshaler) NewEncoder

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

NewEncoder implements gwruntime.Marshaler.

func (*JSONMarshaler) Unmarshal

func (j *JSONMarshaler) Unmarshal(data []byte, v interface{}) error

Unmarshal implements gwruntime.Marshaler.

type JSONOpt added in v3.7.0

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

JSONOpt 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