How to keep undefined values in JSON.stringify
The JSON spec does not allow undefined values, so when you try to stringify an object that contains an undefined value, the key will get removed:
const person = { name: 'Peter', age: undefined };
JSON.stringify(person);
// '{"name":"Peter"}'
There ...
petermekhaeil.hashnode.dev1 min read