json

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2025 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyArray = regexp.MustCompile("^\\[]$")
View Source
var KeysToDelete = []string{
	".data.links",
	".data.meta",
	".data[].links",
	".data[].meta",
	".links",
	".meta",
	"..|nulls",
	`..|select(. == {})`,
	`..|select(. == {})`,
	`..|select(. == "")`,
}
View Source
var MonochromeOutput = false
View Source
var QuotedString = regexp.MustCompile("^\\\".+\\\"$")
View Source
var TreatAsLiterals = regexp.MustCompile("^(-?[0-9]+(\\.[0-9]+)?|false|true|null)$")

Functions

func Compact added in v0.11.0

func Compact(json string) (string, error)

func FromJson added in v0.14.0

func FromJson(json string) ([]string, error)

FromJson is the inverse operation of ToJson it converts a json object into the key value pairs we would type on the command line

func FromJsonToMap added in v0.14.0

func FromJsonToMap(json string) (map[string]string, error)

FromJsonToMap converts a json string into a map of key value pairs.

func NewEncoder

func NewEncoder(tab bool, indent int, monoOutput bool) *encoder

func PrettyPrint added in v0.10.0

func PrettyPrint(in string) string

func PrintJsonAsKeyValue added in v0.14.0

func PrintJsonAsKeyValue(json string) error

func PrintJsonToStderr added in v0.5.0

func PrintJsonToStderr(json string) error

func PrintJsonToStdout added in v0.14.0

func PrintJsonToStdout(json string) error

func PrintJsonToWriter added in v0.14.0

func PrintJsonToWriter(json string, w io.Writer) error

func RunJQ added in v0.7.0

func RunJQ(queryStr string, result interface{}) (interface{}, error)

func RunJQOnString added in v0.8.1

func RunJQOnString(queryStr string, json string) (interface{}, error)

func RunJQOnStringAndGetString added in v0.12.0

func RunJQOnStringAndGetString(queryStr string, json string) (string, error)

func RunJQOnStringAndMarshalResponse added in v0.12.0

func RunJQOnStringAndMarshalResponse(queryStr string, json string, obj any) error

func RunJQOnStringWithArray added in v0.9.0

func RunJQOnStringWithArray(queryStr string, json string) ([]interface{}, error)

These copy and paste functions below, were because the existing functions were buggy if the iterator returns more than one thing, only the last is saved. it was deemed to risky to fix at the moment.

func RunJQWithArray added in v0.9.0

func RunJQWithArray(queryStr string, result interface{}) ([]interface{}, error)

func ToJson

func ToJson(args []string, noWrapping bool, compliant bool, attributes map[string]*resources.CrudEntityAttribute, useAliases bool, autoAddConstantValues bool) (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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