jsonhelper

package
v0.0.0-...-c2e30b8 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2021 License: NIST-PD-fallback Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Roundtrip

func Roundtrip(input, ptr interface{}, options ...Option) error

Roundtrip marshals the input to JSON then unmarshals it into ptr. This is useful for converting between structures.

Types

type Option

type Option func(*json.Decoder)

Option sets an option on json.Decoder.

var DisallowUnknownFields Option = func(d *json.Decoder) { d.DisallowUnknownFields() }

DisallowUnknownFields causes json.Decoder to reject unknown struct fields.

Jump to

Keyboard shortcuts

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