Documentation
¶
Index ¶
- func As(v any, indent int) string
- func BytesJSON(v any) ([]byte, error)
- func BytesJSONIndent(v any, indent string) ([]byte, error)
- func BytesYAML(v any) ([]byte, error)
- func JSON(v any) string
- func JSONIndent(v any, indent string) string
- func JSONIndentN(v any, n int) string
- func Pretty(v any) string
- func PrettyYAML(v any) string
- func YAML(v any) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func As ¶
As returns JSON string representation of v; when indent > 0, it pretty-prints with that many spaces.
func BytesJSONIndent ¶
BytesJSONIndent returns the indented JSON bytes and any error encountered.
func JSON ¶
JSON returns a compact JSON string representation of v. On error, it returns a best-effort fallback using fmt with the error appended.
func JSONIndent ¶
JSONIndent pretty-prints v as JSON with the provided indent string (e.g., " " or "\t"). On error, it returns a best-effort fallback using fmt with the error appended.
func JSONIndentN ¶
JSONIndentN pretty-prints v as JSON with n spaces of indentation (n <= 0 defaults to 2).
func PrettyYAML ¶ added in v0.0.17
PrettyYAML is an alias for YAML (YAML is pretty by default).
Types ¶
This section is empty.