Documentation
¶
Overview ¶
Package jsonvalue preserves numbers in scoped application, policy, and opaque catalog JSON without changing unrelated control metadata or typed counters.
Index ¶
- func CanonicalNumber(number json.Number) (json.Number, error)
- func CompareNumbers(a, b json.Number) (int, bool)
- func DecodeUnique(data []byte) (any, error)
- func Equal(a, b any) bool
- func EqualNumbers(a, b json.Number) bool
- func Unmarshal(data []byte, value any) error
- func UnmarshalOptionalObject(data []byte, value *map[string]interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanonicalNumber ¶
CanonicalNumber compacts a JSON number without expanding its exponent. It removes insignificant zero digits before passing a value to native codecs.
func CompareNumbers ¶
CompareNumbers orders exact JSON decimals without converting to a float or expanding an exponent. The result is -1, 0 or 1; invalid tokens return false.
func DecodeUnique ¶
DecodeUnique preserves numbers and rejects ambiguous object members at every depth. Use it when one interpretation authorizes bytes another service reads.
func Equal ¶
Equal compares decoded JSON values without rounding numbers. Equivalent numeric spellings such as 1, 1.0 and 1e0 compare equal.
func EqualNumbers ¶
EqualNumbers compares JSON decimal values exactly, without expanding their exponents. Memory and work remain bounded by the number tokens' lengths.
func Unmarshal ¶
Unmarshal has json.Unmarshal's single-document contract, but decodes numbers inside interfaces as json.Number instead of converting them to float64.
func UnmarshalOptionalObject ¶ added in v0.10.0
UnmarshalOptionalObject decodes an opaque SQL control map. Empty database values and JSON null retain the legacy nil-map representation. Malformed nonempty data fails closed without including stored data in the error.
Types ¶
This section is empty.