Converts a bigint to the simplest value-preserving JSON value available.
There is no type information included. The output is always a number
(with no fractional part) or a string which can be parsed by BigInt(s).
Numbers are used preferentially for values in the range between
Number.MIN_SAFE_INTEGER and Number.MAX_SAFE_INTEGER where no accuracy
is lost. Stringified values may be hex or decimal encoded for minimal size.
Note that this function doesn't enforce any bounds on the input. Any
bigint will be encoded, even if it's not a valid POD value.
Converts a bigint to the simplest value-preserving JSON value available. There is no type information included. The output is always a number (with no fractional part) or a string which can be parsed by
BigInt(s)
.Numbers are used preferentially for values in the range between
Number.MIN_SAFE_INTEGER
andNumber.MAX_SAFE_INTEGER
where no accuracy is lost. Stringified values may be hex or decimal encoded for minimal size.Note that this function doesn't enforce any bounds on the input. Any bigint will be encoded, even if it's not a valid POD value.