jsonvalue

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package jsonvalue preserves numbers in scoped application and policy JSON without changing unrelated control metadata or typed counters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalNumber

func CanonicalNumber(number json.Number) (json.Number, error)

CanonicalNumber compacts a JSON number without expanding its exponent. It removes insignificant zero digits before passing a value to native codecs.

func CompareNumbers

func CompareNumbers(a, b json.Number) (int, bool)

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

func DecodeUnique(data []byte) (any, error)

DecodeUnique preserves numbers and rejects ambiguous object members at every depth. Use it when one interpretation authorizes bytes another service reads.

func Equal

func Equal(a, b any) bool

Equal compares decoded JSON values without rounding numbers. Equivalent numeric spellings such as 1, 1.0 and 1e0 compare equal.

func EqualNumbers

func EqualNumbers(a, b json.Number) bool

EqualNumbers compares JSON decimal values exactly, without expanding their exponents. Memory and work remain bounded by the number tokens' lengths.

func Unmarshal

func Unmarshal(data []byte, value any) error

Unmarshal has json.Unmarshal's single-document contract, but decodes numbers inside interfaces as json.Number instead of converting them to float64.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL