Documentation
¶
Overview ¶
Package jsonvalue preserves numeric tokens for domain operations that require exact JSON numbers, while retaining JSON v2's strict input validation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Numbers = json.WithUnmarshalers(json.UnmarshalFromFunc(func(decoder *jsontext.Decoder, value *any) error { if decoder.PeekKind() != '0' { return errors.ErrUnsupported } token, err := decoder.ReadToken() if err != nil { return err } *value = jsonv1.Number(token.String()) return nil }))
Numbers keeps the original numeric token instead of rounding it to float64. Non-number values use the ordinary JSON v2 decoder and its default semantics. JSON v2 has no Number type; json.Number is retained as the interoperable exact numeric value consumed by schema validation and other numeric domain operations.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.