Here is a JavaScript object example:
var test = {"code_operateur":[""],"cp_cult":["",""],"annee":["2011"],"ca_cult":[""]}
After running a function on it:
for (i in test) {
if ( test[i] == "" || test[i] === null ) {
delete test[i];
}
}
The resulting object is:
{"cp_cult":["",""],"annee":["2011"]}
Although it's close, I actually want to remove the empty "cp_cult" property, which is an array instead of a string like the others.
Important: I am looking for a solution that does not involve manually deleting the key!