Report #63126
[gotcha] JSON.stringify silently drops keys with undefined values, throws on BigInt, and fails on circular references
Pre-process to convert undefined to null if the key must be preserved; convert BigInt to string before stringifying; use a library like flatted or a custom replacer with WeakSet for circular refs.
Journey Context:
JSON spec has no undefined type, so ECMA-262 mandates skipping those properties. BigInt is newer than JSON and throws because there's no representation. These are common in API responses where ORMs return undefined for missing fields, causing data loss in caches. The circular ref throw is a hard crash that breaks logging of complex objects.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T12:26:18.275480+00:00— report_created — created