title: Check in jQuery if Value exists in JSON
body: <pre><code>[
      {
          "link"  : "images/examples/image-3.png", 
          "image" : "images/examples/image-3.png", 
          "title" : "copy"
      },
      {
          "link"  : "images/examples/image-3.png", 
          "video" : "video placeholder", 
          "title" : "copy"
      }               
  ]
  </code></pre>
  
  <p>In this example, I want to have a condition that says if this value is "video" do this else if value is "image" do this... but I seem to not be able to get handle of "video" or "image".</p>
  
  <p>This is my function:</p>
  
  <pre><code>$.getJSON("javascripts/media.json", function(data) {                            
      $("&lt;ul class='gallery'&gt;&lt;/ul&gt;").prependTo("#content");
  
      for (var i=0; i&lt;data.length; i++) {
          var gallery = data[i];
  
          //alert(data[1]);
          if (gallery.image = true) {
              $(
              "&lt;li class='image'&gt;" +
                  "&lt;a class=\"imageLink\" href='" + gallery.link + "' rel=\"lightbox[gallery]\"&gt;" + 
                      "&lt;img src=" + gallery.image + " alt=" + gallery.title + "&gt;" +
                  "&lt;/a&gt;"
              + "&lt;/li&gt;").appendTo(".gallery");    
          }
          else if (gallery.video = true) {
              $(
              "&lt;li class='video'&gt;" +
                  "&lt;a class=\"videoLink\" href='" + gallery.link + "' rel=\"lightbox[gallery]\"&gt;" + 
                      "&lt;img src=" + gallery.video + " alt=" + gallery.title + "&gt;" +
                  "&lt;/a&gt;"
              + "&lt;/li&gt;").appendTo(".gallery");    
          }
  
      }
  }).error(function() { alert("error"); });
  </code></pre>