Documentation
¶
Overview ¶
Package jsonwire owns bounded, lossless JSON parsing for typed values and transport.
Index ¶
Constants ¶
const ( MaxBytes = 1 << 20 MaxDepth = 64 MaxNodes = 10000 )
Variables ¶
This section is empty.
Functions ¶
func Canonical ¶
Canonical preserves transport strings (including escaped NUL), sorts object names, normalizes exact decimal numbers and retains array order. It shares the same parser and budgets as Decode and storage Parse.
func Decode ¶
Decode reads a transport document without storage-specific normalization. Numbers retain their exact input lexeme as json.Number. Escaped NUL is valid JSON and remains intact; codecs and application validation can reject it. Callers bound the body before supplying its bytes. No canonical copy is made.
func Measure ¶
Measure bounds a document already produced by a validating encoder, such as encoding/json/v2 with duplicate names and invalid UTF-8 rejected. It rechecks bytes, UTF-8 and escapes, then counts depth and nodes exactly as Decode does, in one allocation-free pass without building a tree. It does not re-validate general JSON syntax; use Decode for untrusted input.
Types ¶
type Limits ¶
Limits bounds one transport document. Bytes and Nodes must be positive. Depth is the maximum child depth, with the root at zero; it may be reduced below MaxDepth but cannot exceed that parser recursion bound. Object names consume one node each in addition to their values. There are no implicit transport defaults here: the calling boundary owns its configuration.