title: Display all items in a json array
body: <p>I am trying to work with json and I almost have what I need. I am getting the correct info to display but I am having to pass each item of an array into a variable and then print the variable. I would like to display all of the items in each array. The json data I am working with is from an invoicing app (<a href="http://www.curdbee.com" rel="nofollow noreferrer">www.curdbee.com</a>) and I am trying to show each invoice for a client. The data that I want to show is each line item, the line item price, and the total amount. Here is my code:</p>
  
  <pre class="lang-js prettyprint-override"><code>$(document).ready(function() {
  
  
      $.getJSON('https://nspirelab.curdbee.com/invoices.json?api_token=__token__', function(data){
          $.each(data, function(index, item){
              var total = item.invoice.total_billed;
              var lineItemName1 = item.invoice.line_items[0].name_and_description;
              var lineItemName2 = item.invoice.line_items[1].name_and_description;
              var lineItemPrice1 = item.invoice.line_items[0].price; 
              var lineItemPrice2 = item.invoice.line_items[1].price; 
  
              $('#results').append('&lt;div class="lineItem"&gt;&lt;ul&gt;&lt;li&gt;' + lineItemName1 + lineItemPrice1 + '&lt;/li&gt;&lt;li&gt;' + lineItemName2 + lineItemPrice2 + '&lt;/li&gt;&lt;li&gt;' + total + '&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;');
          });
  
      });
  
  });
  </code></pre>