jsonUtilities

package
v2.21.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Separator character which is used when setting the path via a dot notation
	Separator = "."
)

Variables

View Source
var ErrJSONDecode = errors.New("failed to decode JSON")
View Source
var ErrOpenFile = errors.New("failed to open file")
View Source
var ErrReadFile = errors.New("failed to read file")
View Source
var ErrUnevenKeys = errors.New("Uneven number of key value pairs")
View Source
var Logger *logger.Logger

Logger is the package logger

Functions

func DecodeJSONFile

func DecodeJSONFile(filename string) (map[string]interface{}, error)

DecodeJSONFile returns the contents of a json file as a map

func IsJSONArray

func IsJSONArray(v []byte) bool

IsJSONArray returns true if the byte array represents a JSON array

func IsJSONObject

func IsJSONObject(v []byte) bool

IsJSONObject returns true if the byte array represents a JSON object

func IsValidJSON

func IsValidJSON(v []byte) bool

IsValidJSON returns true if the given byte array is a JSON array of JSON object

func MustParseJSON

func MustParseJSON(value string) map[string]interface{}

MustParseJSON parses a string and returns the map structure

func ParseJSON

func ParseJSON(value string, data map[string]interface{}) error

ParseJSON parses a string and returns the map structure. It will parse json and shorthand json.

func UnescapeJSON

func UnescapeJSON(v []byte) string

UnescapeJSON replaces unicode escape characters with the actual character

Types

type JsonDecodeError

type JsonDecodeError struct {
	Err error
}

Jump to

Keyboard shortcuts

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