Documentation ¶
Overview ¶
Package jsonutil provides functions for working with JSON.
Index ¶
- func Indent(data []byte, v interface{}, prefix, indent string) ([]byte, error)
- func MustIndent(data []byte, v interface{}, prefix, indent string) []byte
- func MustMarshal(v interface{}) []byte
- func MustMarshalIndent(v interface{}, prefix, indent string) []byte
- func MustUnmarshal(data []byte, v interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Indent ¶
Indent a json string by unmarshalling it and marshalling it with MarshalIndent.
The data will be unmarshalled in to v, which must be a pointer. Example:
Indent(`{"a": "b"}`, &map[string]string{}, "", " ")
func MustIndent ¶
MustIndent behaves like Indent but will panic on errors.
func MustMarshal ¶
func MustMarshal(v interface{}) []byte
MustMarshal behaves like json.Marshal but will panic on errors.
func MustMarshalIndent ¶
MustMarshalIndent behaves like json.MarshalIndent but will panic on errors.
func MustUnmarshal ¶
func MustUnmarshal(data []byte, v interface{})
MustUnmarshal behaves like json.Unmarshal but will panic on errors.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.