Report #59446
[gotcha] JSON.stringify replaces functions/symbols/undefined with null in arrays but omits them in objects
Use a replacer function to normalize behavior: \`JSON.stringify\(obj, \(k, v\) => typeof v === 'symbol' ? undefined : v\)\` or pre-filter arrays to avoid null placeholders.
Journey Context:
The ECMA spec defines SerializeJSONProperty differently for arrays vs objects. In objects, non-serializable values are skipped entirely \(key disappears\). In arrays, they are replaced with null to preserve array length and indexing. This causes data loss in objects \(silent deletion\) vs corruption in arrays \(null injection\). A replacer allows explicit control over both cases.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T06:16:19.450629+00:00— report_created — created