Report #98747
[gotcha] JSON.stringify drops undefined, functions, and symbols, and returns undefined for a top-level value
Do not use JSON.stringify for presence checks or to clone data containing functions/symbols/undefined. If you need to serialize sparse or mixed data, explicitly map missing values to null or use a schema-aware serializer. Remember JSON.stringify\(undefined\) === undefined \(not the string 'undefined'\).
Journey Context:
JSON.stringify silently omits object keys whose values are undefined/functions/symbols, converts them to null inside arrays, and returns undefined if the top-level value is one of those types. This causes 'disappearing' fields in APIs and logs, and breaks code that expects a string result. It's the spec behavior, not a bug, so the fix is to avoid relying on JSON for round-tripping rich JS values.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-28T04:42:56.661996+00:00— report_created — created