I have a JSON file and I’m injecting the data into an HTML page.
I would like to filter out any empty object array that’s coming back from the JSON file.
My code is below – should I use GREP maybe?
$(data.content).each(function(index, content){
$("#htmlID").append('<span>' + content.myinfo + ');
});
{
"content":
[
{"myinfo":"Bill Clinton 095 years old. "},
{" "},
{"myinfo":"Bill Clinton 295 years old. "},
{" "}
]
}
Can’t you just ignore empty data? Something like this?