JSON.parse Reviver Gets an Empty Key: Filter the Root After Parsing
Trace the empty keys a JSON.parse reviver receives, then filter top-level fields after parsing while keeping a real empty key and nested settings.
Page 2 / 17
Posts 9–16 of 134
Trace the empty keys a JSON.parse reviver receives, then filter top-level fields after parsing while keeping a real empty key and nested settings.
See how encodeInto can split a flag or drop an accent in a fixed UTF-8 buffer. Use Intl.Segmenter to write whole graphemes and verify the byte counts.
Check what structuredClone copies or detaches for a Uint8Array subarray, then use slice() to isolate the visible bytes before sharing them.
See why JSON.stringify turns NaN and both infinities into null, then test a field-specific encoding that preserves them alongside genuine null values.
See why JavaScript sort skips undefined in its comparator, then test two ways to move undefined first with numeric sorting or stable grouping.
See where Map.groupBy results lose groups during JSON serialization, then round-trip numeric and string IDs separately with an array of entries.
Compare flat(0), flat(1), and spread on one sparse array. See which copies shift indexes, fill holes with undefined, or leave nested arrays alone.
Reproduce two null failures in JavaScript destructuring defaults and normalize JSON options while preserving valid zero and false settings.