package
Version:
v0.30.0
Opens a new window with list of versions in this module.
Published: Aug 31, 2026
License: MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
Package jsonutil centralizes JSON encoding so output is compact by default and
indented only when asked.
Marshal encodes v as JSON. When pretty is true the output is indented with two
spaces, otherwise it is compact.
func OrEmpty[T any](s []T) []T
OrEmpty returns a non-nil slice so JSON output shows an empty array instead of null.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.