title: Create JSON object with variables from an array
body: <p>I want to create a JSON object with an array and I can't seem to solve the problem. The problem I'm having is that it only assigns the last index value to my variable.Can someone show me how to assign everything produced in my loop to one variable?</p>
  
  <p>... so I've ben able to loop my array through my json object, but am having trouble with the details.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>lineitems = []
  
  for q in ItemDetails:
      myItemName = q[0]
      myQuantity = q[1]
      myUnitAmount = float(q[2])
      myItemCode = str(q[3])
  
      myjson3 = {
                  'ItemCode': myItemCode,
                  'Description': myItemName,
                  'UnitAmount': myUnitAmount * myDiscount,
                  'Quantity': myQuantity,
                  'AccountCode': myAccountCode,
                  'TaxType': myTaxType
              },
  
      lineitems.append(myjson3)
  
  print({'LineItems': myjson3})
  </code></pre>
  
  <p>This gives me:</p>
  
  <pre><code>"LineItems": [
  [
    {
      "AccountCode": null, 
      "Description": "Banana Parfait", 
      "UnitAmount": 0.0, 
      "TaxType": null, 
      "ItemCode": "44", 
      "Quantity": 2.0
    }
  ], 
  [
    {
      "AccountCode": null, 
      "Description": "Blackened Tofu", 
      "UnitAmount": 5.95, 
      "TaxType": null, 
      "ItemCode": "42", 
      "Quantity": 1.0
    }
  ]....]
  </code></pre>
  
  <p>but I'm trying to get: ... is this important? I very new to JSON objets</p>
  
  <pre><code>  "LineItems": [
    {
      "AccountCode": null, 
      "Description": "Banana Parfait", 
      "UnitAmount": 0.0, 
      "TaxType": null, 
      "ItemCode": "44", 
      "Quantity": 2.0
    }
  ,
    {
      "AccountCode": null, 
      "Description": "Blackened Tofu", 
      "UnitAmount": 5.95, 
      "TaxType": null, 
      "ItemCode": "42", 
      "Quantity": 1.0
    }....
  ]
  </code></pre>