title: How can I extract certain attributes from a JSON file
body: <p>So I have a JSON file:</p>
  
  <pre><code>{
      "business_id": "5UmKMjUEUNdYWqANhGckJw",
      "full_address": "4734 Lebanon Church Rd\nDravosburg, PA 15034",
      "hours": {
          "Friday": {
              "close": "21:00",
              "open": "11:00"
          },
          "Tuesday": {
              "close": "21:00",
              "open": "11:00"
          },
          "Thursday": {
              "close": "21:00",
              "open": "11:00"
          },
          "Wednesday": {
              "close": "21:00",
              "open": "11:00"
          },
          "Monday": {
              "close": "21:00",
              "open": "11:00"
          }
      },
      "open": true,
      "categories": ["Fast Food",
      "Restaurants"],
      "city": "Dravosburg",
      "review_count": 4,
      "name": "Mr Hoagie",
      "neighborhoods": [],
      "longitude": -79.9007057,
      "state": "PA",
      "stars": 4.5,
      "latitude": 40.3543266,
      "attributes": {
          "Take-out": true,
          "Drive-Thru": false,
          "Good For": {
              "dessert": false,
              "latenight": false,
              "lunch": false,
              "dinner": false,
              "brunch": false,
              "breakfast": false
          },
          "Caters": false,
          "Noise Level": "average",
          "Takes Reservations": false,
          "Delivery": false,
          "Ambience": {
              "romantic": false,
              "intimate": false,
              "classy": false,
              "hipster": false,
              "divey": false,
              "touristy": false,
              "trendy": false,
              "upscale": false,
              "casual": false
          },
          "Parking": {
              "garage": false,
              "street": false,
              "validated": false,
              "lot": false,
              "valet": false
          },
          "Has TV": false,
          "Outdoor Seating": false,
          "Attire": "casual",
          "Alcohol": "none",
          "Waiter Service": false,
          "Accepts Credit Cards": true,
          "Good for Kids": true,
          "Good For Groups": true,
          "Price Range": 1
      },
      "type": "business"
  }
  </code></pre>
  
  <p>and I want to extract all the attributes that have a value of true and store them into a table in HTML. I'm a bit stuck on this problem, but this is what I have so far</p>
  
  <pre><code>function saf(){
    loadJSON(function(response){
      var actual_JSON = JSON.parse(response);
  
      var takeout = actual_JSON.attributes;
      for(i in takeout){
        if(takeout[i]==true){
          var tr = document.createElement("tr");
          var td = document.createElement("td");
          var table = document.getElementById("service_table");
          var textnode = document.createTextNode(takeout[i]);
          td.appendChild(textnode);
          tr.appendChild(td);
          table.appendChild(tr);
        }
      }
  
    });
  }
  </code></pre>
  
  <p>What else is necessary for me to complete this task? Is there a way for me to even for each loop through the JSON object? I'm not sure where to head from here so I'm looking for some help on this one. Should I be appending the data to the table object? </p>