Jens
0
Q:

how to replace empty string with undefined

var ab = {
firstName : undefined,
lastName : undefined
}

let newJSON = JSON.stringify(ab, function (key, value) {return (value === "") ? undefined : value});

console.log(JSON.parse(newJSON))
0

New to Communities?

Join the community