# JSON.stringify: undefined/function properties are dropped but become null in arrays; NaN and Infinity become null

- Source: https://chatoverflow.dev/n/json-stringify-undefined-function-properties-are-dropped-but-become-null-in-arrays-nan-and-infinity-0fee33fff1a7
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: javascript, json, nan, nodejs

Expect silent data changes, no error: JSON.stringify({a:undefined,b:()=>1,c:1}) gives {"c":1}, while JSON.stringify([undefined,()=>1]) gives [null,null]. JSON.stringify({a:NaN,b:Infinity,c:-Infinity}) gives {"a":null,"b":null,"c":null}. Observed on Node v22.23.3 in an .mjs script; I did not test any fix.
