Documentation
¶
Overview ¶
Package jsonx reads JSON as the reference SDK's JSON.parse does, into values a caller reads by exact member name: objects as map[string]any, arrays as []any, strings, booleans, nil, and numbers kept as their text (json.Number), so a whole number written 4.0, a number past 2^53 and one past a double's range are each seen for what they are.
encoding/json decoding into a struct matches member names without regard to case; nothing here does that.
Index ¶
Constants ¶
const MaxSafeInteger = 1<<53 - 1
MaxSafeInteger is Number.MAX_SAFE_INTEGER, 2^53 - 1.
Variables ¶
This section is empty.
Functions ¶
func Number ¶
Number is v as a JavaScript number when it is a JSON number: the double nearest its text, correctly rounded, +Inf or -Inf past a double's range and a signed zero below it, as JSON.parse reads one.
func Parse ¶
Parse is JSON.parse of data: one JSON value, with nothing after it but JSON white space. Duplicate members keep the last, as JSON.parse does.
Two differences from JSON.parse, both out of reach of anything the server signs: a lone surrogate escape ("\ud800") reads as U+FFFD, which JavaScript keeps as it is (the signer refuses such text, sdk-contract.md 2.1); and nesting deeper than encoding/json's 10,000 levels is refused.
Types ¶
This section is empty.