jsonUtilities

package
v2.57.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 12 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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