Report #8759
[gotcha] JSON.stringify\(\{a: undefined\}\) returns '\{\}' dropping key, but JSON.stringify\(\[undefined\]\) returns '\[null\]' converting to null
Pre-process objects to strip undefined values explicitly if you need consistent omission, or replace undefined with null in arrays if you need nulls; avoid relying on JSON.stringify for undefined handling—normalize data structures before serialization
Journey Context:
The ES spec treats object properties and array elements differently: object keys with undefined values are excluded during serialization \(SerializeJSONObject\), while array elements that are undefined are converted to null \(SerializeJSONArray\). This creates asymmetry when round-tripping data—parsing the JSON results in different structures for objects vs arrays. Developers often assume undefined becomes null universally or is dropped universally, leading to API contract violations.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T06:20:20.331677+00:00— report_created — created