jsonraw

package
v0.68.11 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2025 License: MIT Imports: 8 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equal

func Equal(x, y io.Reader) (bool, error)

func EqualBytes

func EqualBytes(x, y []byte) (bool, error)

func EqualFiles

func EqualFiles(x, y string) (bool, error)

func Indent

func Indent(r io.Reader, prefix, indent string) ([]byte, error)

Indent returns a byte slice of indented JSON given an `io.Reader`. It is useful to use with `http.Response.Body` which is an `io.ReadCloser`.

func IndentBytes

func IndentBytes(data []byte, prefix, indent string) ([]byte, error)

IndentBytes converts a JSON byte array into a prettified byte array.

func MarshalFileIndentBytes

func MarshalFileIndentBytes(name string, data []byte, prefix, indent string, perm fs.FileMode) error

func ObjectKeys

func ObjectKeys(b []byte) ([]string, error)

func ObjectKeysFile

func ObjectKeysFile(filename string) ([]string, error)

func ObjectModify

func ObjectModify(b []byte, fieldNamesInclCopy []string, fieldNameInclUpsertValues map[string]any) ([]byte, error)

ObjectModify creates a new byte slice, from an existing byte slice, with only the supplied field names.

func PrintIndent

func PrintIndent(r io.Reader, prefix, indent string) ([]byte, error)

PrintIndent returns an indented JSON byte array given an `io.Reader`.

func Unescape

func Unescape(b []byte, prefix, indent string) ([]byte, error)

Unescape is designed to unescape a stringified JSON. It is typically used after a stringified JSON has been embedded as a value in an wrapper JSON object. When using this, do not include outer quotes.

Types

This section is empty.

Jump to

Keyboard shortcuts

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