title: How to send JSON array of objects in email body with mailto: link?
body: <p>I've been beating my head against the desk today. Instead of dealing with forms/APIs, I'm trying to let people make an order (with a shopping cart) directly via email using a mailto link.
  My data looks like this:</p>
  
  <pre><code>[
    {
      "image": "https://static.wixstatic.com/awefawef.jpg",
      "name": "xyz",
      "price": "20.00",
      "id": "3",
      "quantity": 30
    },
    {
      "image": "https://static.wixstatic.com/media/aweawfefeaw.png",
      "name": "abc",
      "price": "20.00",
      "id": "4",
      "quantity": 20
    }
  ]
  </code></pre>
  
  <p>Trying to have the email be either a table with the the name, price, and quantity or just some sort of simple list/invoice like:</p>
  
  <p>Items Needed:</p>
  
  <pre><code> - name: abc 
  quantity:30 
  price:  $600 
  
  - name: xyz 
  quantity: 20 
  price: $400
  - Total Price: $1000
  
  customer name: [insert name]
  customer email: [insert email]
  customer company: [insert company]
  </code></pre>
  
  <p>I'm struggling to parse the data in some sort of usable form for the <code>body</code> in the mailto link. Here's what I've got so far (this is in React)...the shopping cart array is <code>this.state.cart</code> :</p>
  
  <pre><code> sendEmail(){
  
          let body;
  
          this.state.cart.forEach(function(element) {
              //console.log(element);
              body = 'name:' + element.name;
              body += '\nprice:' + element.price;
              body += '\nquanity:' + element.quantity;
              body += '\ntotal:' + element.quantity * element.price;
          });
  
      window.location.href="mailto:sales@email.com?subject= Order for [Insert Name]&amp;body=" + encodeURIComponent(body)
  
      }
  </code></pre>
  
  <p>This sort of works but I can't figure out how to get all of them in an ordered fashion. Only the last one works. It also opens in the native Mac mail app. As you can tell, I'm a bit turned around.</p>