title: jQuery : how to switch case when requesting JSON info
body: <p>I'm a total novice with jQuery (and javascript in general!), so with that in mind please be merciful! :)</p>
  
  <p>I'm trying to pull information from a JSON database, to do that I've created a search box and I've managed to source a solution for requesting the data that seems to work perfectly if I type in the EXACT thing I am looking for. But obviously I would like to have it so that the user doesn't need to worry about case matching.</p>
  
  <p>I figured the most sensible thing to do would be to use some sort of fuzzy search but so far my efforts have resulted in exactly squat!</p>
  
  <p><strong>Here is the function that pulls the data:</strong></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function getObjects(obj, key, val) {
      var objects = [];
      for (var i in obj) {
          if (!obj.hasOwnProperty(i)) continue;
          if (typeof obj[i] == 'object') {
              objects = objects.concat(getObjects(obj[i], key, val));
          } else if (i == key &amp;&amp; obj[key] == val) {
              objects.push(obj);
          }
      }
      return objects;
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>And here is the nightmare that is my attempt to deal with that information:</strong></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$.getJSON("json/AllSets.json",function(hearthStoneData){
    $('.submit').click(function(){
     var searchValue = $('#name').val();
     var inputValue = searchValue.toUpperCase();
     var returnValue = getObjects(hearthStoneData, "name", searchValue);
     var outputValue = returnValue.toString();
     console.log(outputValue);
    });
   });</code></pre>
  </div>
  </div>
  </p>
  
  <p>Does anybody have any advice on where I'm going wrong? I think I've gone waaaay off the beaten path with all the variables in the last part, I was trying to set both user input and the returned data to upper case but I think the fuzzy search option would make more sense?</p>
  
  <p>Anyway, I appreciate any help you can offer, thanks for taking the time to read through what I imagine is some very confused code :P</p>