Index
func Bytes
go
func Bytes(value any) []byte
Bytes is a function that converts the given value to a JSON string, converted to bytes.
Usage:
jsonx.Bytes(map[any]any{"foo": 1, "bar": 2}) // []byte{'{"foo":1,"bar":2}'}
func Map
go
func Map(jsonstring string) map[string]any
String is a function that converts the given json string into map[string]any. Should be used in a known environment, when values are expected to be correct. Panics in case of failure.
Usage:
jsonx.Map({"foo":1,"bar":2}) // map[string]any{"foo": 1, "bar": 2}
func String
go
func String(value any) string
String is a function that converts the given value to a JSON string. Almost useless for typical use-cases, but useful as template function.
Usage:
jsonx.String(map[any]any{"foo": 1, "bar": 2}) // {"foo":1,"bar":2}
Generated by gomarkdoc