I'm trying to iterate the DOM and a JSON response and add a CSS class to a list item if it is on that JSON or not.

Here's a [fiddle example](http://jsfiddle.net/elsevero/Z688d/), can anyone give a hand to do it properly? It seems my approach is not good.

```
    $('#list li').each(function(){
         if ($(this).children().first().next().attr('child-name') == val.name[0] && ($(this).children().first().next().parent().hasClass('available') == false || $(this).children().first().next().parent().hasClass('notavailable') == false)) { 
       $(this).addClass("available");
 } else if (($(this).children().first().next().parent().hasClass('available') == false || $(this).children().first().next().parent().hasClass('notavailable') == false) && val.name[0] != "#N/A") {
       $(this).addClass("notavailable");
}
});

```

So, trying to add a class here:

if is not in the json

```
<li data-id="id-4" client-id="4" class="myclass notavailable"><!-- Conent here --></li>

```

if is in the json

```
<li data-id="id-4" client-id="4" class="myclass available"><!-- Conent here --></li>

```