Report #69457
[gotcha] JSON.stringify throws TypeError on BigInt values
Never pass BigInt directly to JSON.stringify. Use a replacer function: \`JSON.stringify\(data, \(key, value\) => typeof value === 'bigint' ? value.toString\(\) : value\)\` or convert to String/Number before serialization.
Journey Context:
BigInt handles integers beyond 2^53-1, but the JSON specification does not support BigInt as a primitive type. The ECMAScript specification explicitly requires JSON.stringify to throw a TypeError when encountering BigInt, rather than coercing it. This breaks APIs that suddenly receive large integers. The only safe path is explicit conversion via a replacer or pre-processing.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T23:04:01.486784+00:00— report_created — created