Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Unmarshal = json.Unmarshal Marshal = json.Marshal MarshalIndent = json.MarshalIndent UnmarshalString = func(s string, val any) error { return Unmarshal(string2Bytes(s), val) } MarshalString = func(val any) (string, error) { bs, err := Marshal(val) if err != nil { return "", err } return bytes2String(bs), nil } NewEncoder = func(w io.Writer) JSONEncoder { return json.NewEncoder(w) } NewDecoder = func(r io.Reader) JSONDecoder { return json.NewDecoder(r) } MustMarshal = func(v any) []byte { bs, err := Marshal(v) if err != nil { panic(err) } return bs } MustUnmarshal = func(bs []byte, v any) { err := Unmarshal(bs, v) if err != nil { panic(err) } } MustMarshalIndent = func(v any, prefix, indent string) []byte { bs, err := MarshalIndent(v, prefix, indent) if err != nil { panic(err) } return bs } MustMarshalString = func(v any) string { bs, err := Marshal(v) if err != nil { panic(err) } return bytes2String(bs) } MustUnmarshalString = func(s string, v any) { err := Unmarshal(string2Bytes(s), v) if err != nil { panic(err) } } )
Functions ¶
This section is empty.
Types ¶
type JSONDecoder ¶ added in v0.10.0
Click to show internal directories.
Click to hide internal directories.