jsonutil

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EqualJSON

func EqualJSON(a, b string) (bool, error)

EqualJSON compares 2 JSON strings and compares them for semantic equality. That is, they are both parsed to interface{} and tested for equality using reflect.DeepEqual. An error is returned if either a or b is invalid JSON.

func StrictParseJSON

func StrictParseJSON(rawJSON string, v interface{}) error

StrictParseJSON attempts to parse rawJSON into v. If any fields of the rawJSON are not present in v, it returns an error. If any of the fields not tagged omitempty are not present in the rawJSON, it returns an error. Fields marked omitempty are considered optional, but must not be present when empty in the source JSON. StrictParseJSON is case sensitive for field names, so you will need to use json field tags if rawJSON does not use UpperCaseCamel casing. Error messages are not very granular, "empty or missing fields" with a dump of the input JSON and a dump a zeroed v with required fields shown.

Types

This section is empty.

Jump to

Keyboard shortcuts

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