Documentation
¶
Overview ¶
Package strictjson provides an exact JSON decoding boundary for durable authority. It supplements encoding/json with recursive duplicate rejection and case-sensitive field matching; DisallowUnknownFields alone is case-insensitive and therefore cannot prevent alias overwrites.
Index ¶
- func DecodeArray(value []byte, maxBytes int, destination any) error
- func DecodeObject(value []byte, maxBytes int, destination any) error
- func DecodeRawObject(value []byte, maxBytes int, allowed map[string]struct{}) (map[string]json.RawMessage, error)
- func ValidateUniqueArray(value []byte, maxBytes int) error
- func ValidateUniqueObject(value []byte, maxBytes int) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeArray ¶
DecodeArray is DecodeObject's top-level-array counterpart. It exists for narrowly gated legacy formats whose historical root was an array.
func DecodeObject ¶
DecodeObject decodes exactly one JSON object into destination. Object field names must exactly match their Go JSON tags at every recursively typed struct boundary; duplicate, unknown, case-aliased, and trailing data fail.
func DecodeRawObject ¶
func DecodeRawObject( value []byte, maxBytes int, allowed map[string]struct{}, ) (map[string]json.RawMessage, error)
DecodeRawObject returns an exact object whose keys are constrained by allowed. Values remain raw but are still recursively checked for duplicate object fields and the document must contain exactly one value.
func ValidateUniqueArray ¶
ValidateUniqueArray verifies one bounded array and rejects duplicate object keys recursively.
func ValidateUniqueObject ¶
ValidateUniqueObject verifies one bounded object and rejects duplicate keys recursively, including objects nested inside arrays.
Types ¶
This section is empty.