6 ms·
Another flavor of this surprise: JSON.stringify doesn't "see" undefined. JSON.stringify({foo:undefined}) returns "{}" :)
by xamuel 9y ago
Another flavor of this surprise: JSON.stringify doesn't "see" undefined. JSON.stringify({foo:undefined}) returns "{}" :)
- oceanswave 9y agoBecause type (prototype) and data (Json) are two different things, if you need it -- JSON.stringify(obj, (k, v) => v === undefined ? null : v);