title: Create Object Array in foreach Javascript
body: <p>I have an Array with these values, I need to create a loop on these values to return in alasql like this example:</p>
  
  <p><a href="http://jsfiddle.net/agershun/11gd86nx/5/" rel="nofollow noreferrer">http://jsfiddle.net/agershun/11gd86nx/5/</a></p>
  
  <pre><code>var data = {
    "business": [
  {
    "order_contents": [
      {
        "id": 83,
        "name": "product 1",
        "price": "1.99",
        "quantity": 1,
        "total": "1.99",
        "ingredients": [],
        "extras": []
      },
      {
        "id": 83,
        "name": "product 1",
        "price": "1.99",
        "quantity": 1,
        "total": "1.99",
        "ingredients": [],
        "extras": []
      },
      {
        "id": 83,
        "name": "product 1",
        "price": "1.99",
        "quantity": 1,
        "total": "1.99",
        "ingredients": [],
        "extras": []
      },
      {
        "id": 85,
        "name": "product 3",
        "price": "1.99",
        "quantity": 1,
        "total": "1.99",
        "ingredients": [],
        "extras": []
      },
      {
        "id": 83,
        "name": "product 1",
        "price": "1.99",
        "quantity": 1,
        "total": "1.99",
        "ingredients": [],
        "extras": []
      },
      {
        "id": 84,
        "name": "product 2",
        "price": "1.99",
        "quantity": 1,
        "total": "1.99",
        "ingredients": [],
        "extras": []
      },
      {
        "id": 83,
        "name": "product 1",
        "price": "1.99",
        "quantity": 1,
        "total": "1.99",
        "ingredients": [],
        "extras": []
      },
      {
        "id": 83,
        "name": "product 1",
        "price": "1.99",
        "quantity": 1,
        "total": "1.99",
        "ingredients": [],
        "extras": []
      },
      {
        "id": 83,
        "name": "product 1",
        "price": "1.99",
        "quantity": 1,
        "total": "1.99",
        "ingredients": [],
        "extras": []
      },
      {
        "id": 83,
        "name": "product 1",
        "price": "1.99",
        "quantity": 1,
        "total": "1.99",
        "ingredients": [],
        "extras": []
      },
      {
        "id": 83,
        "name": "product 1",
        "price": "1.99",
        "quantity": 1,
        "total": "1.99",
        "ingredients": [],
        "extras": []
      },
      {
        "id": 83,
        "name": "product 1",
        "price": "1.99",
        "quantity": 1,
        "total": "1.99",
        "ingredients": [],
        "extras": []
      },
      {
        "id": 84,
        "name": "product 2",
        "price": "1.99",
        "quantity": 1,
        "total": "1.99",
        "ingredients": [],
        "extras": []
      }
     ]
    }
   ]
  };
  </code></pre>
  
  <p>here's my code..</p>
  
  <pre><code>    info.orderByChild("data").startAt("08/04/2017").endAt("12/06/2017").on('value', function(snapshot){
        snapshot.forEach(function(item) {
  
             jsonObj = {
                "business": [
              {
                "order_contents": [
                  {
                    "id": itemVal['id'],
                    "name": itemVal['name'],
                    "price": itemVal['price'],
                    "quantity": itemVal['quantity'],
                    "total": "itemVal['total']
                  }
                ]
              }
            ]
          }
  </code></pre>
  
  <p>its not creating an array, only the last value..</p>
  
  <p>can someone help me?</p>