Report #4314
[gotcha] JSON.stringify silently drops undefined, functions, and symbols instead of serializing them
Explicitly convert undefined values to null before serialization, or use a replacer function to handle undefined. Never rely on JSON.stringify to preserve undefined values in data structures.
Journey Context:
When caching Redux state or sending payloads to APIs, developers expect JSON.stringify to round-trip their data. However, undefined in object values causes keys to be dropped entirely, while undefined in arrays is converted to null. This creates silent data loss that only appears when deserializing. Functions and symbols are similarly dropped without error. The fix requires explicit null conversion or custom replacer logic.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T19:13:00.710206+00:00— report_created — created