JSON has many empty values, where I want to replace the empty value with a default string.
var json= [
{
"machineNum": "1A",
"serialNo": "123",
"city": ""
},
{
"machineNum": "2B",
"serialNo": "",
"city": ""
},
{
"machineNum": "3A",
"serialNo": "123",
"city": "NewCity"
}
]
var newJson=json.replace("","Not AVailable");
console.log(newJson);
So wherever there is "" - empty value replace with default value "Not Available"
The above is not working.
