{
"top": [{
"language": "English",
"value": ""
}, {
"language": "German",
"value": "hASTA"
}],
"bottom": [{
"language": "English",
"value": "jfgfjg"
}, {
"language": "German",
"value": "fkjhf"
}],
"In": "12 am",
"Out": "3 am",
"Type": ""
}
Hey everyone, I need help in removing keys with empty values from my data before sending it to the API. Using the filter
method caused errors in google sheets.
I only want to send data that has non-empty values.
In this scenario,
for the key 'language' with the value empty under German, I should exclude sending top to the API.
The revised JSON to be sent would look like:
{
"bottom": [{
"language": "English",
"value": "jfgfjg"
}, {
"language": "German",
"value": "fkjhf"
}],
"In": "12 am",
"Out": "3 am"
}
Here is the code snippet used:
apidata = userdata.filter(function(x) { return x !== "" });
Would appreciate any guidance on how to implement this effectively?