Documentation
¶
Overview ¶
Package jsoncompact provides JSON compression by trimming arrays to a configurable maximum.
Index ¶
Constants ¶
View Source
const ( DefaultMaxArrayItems = 3 DefaultMaxStringLen = 500 DefaultMaxDepth = 0 // unlimited )
Default values for compaction options.
Variables ¶
This section is empty.
Functions ¶
func Compact ¶
Compact compresses JSON bytes by trimming arrays and strings. Returns error if input is not valid JSON. If opts is nil, DefaultOptions() is used.
func CompactValue ¶
CompactValue compresses a parsed JSON value (any type from json.Unmarshal). If opts is nil, DefaultOptions() is used.
Types ¶
type Options ¶
type Options struct {
MaxArrayItems int // Trim arrays to N items (0 = no limit)
MaxStringLen int // Truncate strings longer than N chars (0 = no limit)
MaxDepth int // Max recursion depth (0 = unlimited)
}
Options controls JSON compaction behavior.
func DefaultOptions ¶
func DefaultOptions() *Options
DefaultOptions returns the default compaction settings.
Click to show internal directories.
Click to hide internal directories.