title: Search Set Of Key Value Pairs in JSON
body: <p>I have a list of all possible unique product variant combinations in a JSON object [This is how woocommerce is building it]. Say for example I have a product which comes in 2 sizes - size1 and size2 and colors - color1 and color2:</p>
  
  <pre><code>variant_list = [
         {
            "variation_id":328,
            "attributes":{
               "size":"size1",
               "color":"color1"
            }
         },
         {
            "variation_id":329,
            "attributes":{
               "size":"size2",
               "color":"color1"
            }
         },
         {
            "variation_id":330,
            "attributes":{
               "size":"size1",
               "color":"color2"
            }
         },
         {
            "variation_id":331,
            "attributes":{
               "size":"size2",
               "color":"color2"
            }
         ]
  </code></pre>
  
  <p>If user has selected a particular size and color combination (using radio buttons), say for example, size2 and color1 has been chosen, I need to pass the variation id: 329 to my back-end. What is the best way to search my JSON with the attributes criteria set = {"size":"size2","color":"color1"}.</p>
  
  <p>My variant_list object is given - I cannot change it, but my criteria object CAN be built as needed to make this search simple and efficient.</p>
  
  <p>What I have tried and works too, but I know is old school and inefficient :-(
  <a href="http://jsfiddle.net/v18h6qta/6/" rel="nofollow">http://jsfiddle.net/v18h6qta/6/</a></p>