Documentation
¶
Overview ¶
Package jsonutil provide some util functions for quick operate JSON data
Index ¶
- func Decode(bts []byte, ptr any) error
- func DecodeReader(r io.Reader, ptr any) error
- func DecodeString(str string, ptr any) error
- func Encode(v any) ([]byte, error)
- func EncodePretty(v any) ([]byte, error)
- func EncodeToWriter(v any, w io.Writer) error
- func EncodeUnescapeHTML(v any) ([]byte, error)
- func Mapping(src, dst any) error
- func Pretty(v any) (string, error)
- func ReadFile(filePath string, v any) error
- func StripComments(src string) string
- func WriteFile(filePath string, data any) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeReader ¶
DecodeReader decode JSON from io reader.
func DecodeString ¶
DecodeString json string to data ptr.
func EncodePretty ¶
EncodePretty encode pretty JSON data to json bytes.
func EncodeToWriter ¶
EncodeToWriter encode data to writer.
func EncodeUnescapeHTML ¶
EncodeUnescapeHTML data to json bytes. will close escape HTML
func Mapping ¶
Mapping src data(map,struct) to dst struct use json tags.
On src, dst both is struct, equivalent to merging two structures (src should be a subset of dsc)
func StripComments ¶
StripComments strip comments for a JSON string
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.