jsonutil

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: MIT Imports: 8 Imported by: 29

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(bts []byte, ptr interface{}) error

Decode json bytes to data. use it instead of json.Unmarshal

func DecodeReader added in v0.4.3

func DecodeReader(r io.Reader, ptr interface{}) error

DecodeReader decode JSON from io reader.

func Encode

func Encode(v interface{}) ([]byte, error)

Encode data to json bytes. use it instead of json.Marshal

func Pretty

func Pretty(v interface{}) (string, error)

Pretty JSON string and return

func ReadFile

func ReadFile(filePath string, v interface{}) error

ReadFile Read JSON file data

func StripComments added in v0.1.3

func StripComments(src string) string

StripComments strip comments for a JSON string

func WriteFile

func WriteFile(filePath string, data interface{}) error

WriteFile write data to JSON file

Types

This section is empty.

Jump to

Keyboard shortcuts

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