title: How can I remove name value pair object from json array?
body: <p>I'm trying to remove name/value objects from a JSON array. I have working code that is adding elements to another array. I just can't seem to remove elements from the original array that was added to the second array. The code that is adding elements does work. Thanks.</p>
  <p>Sample json array:</p>
  <pre class="lang-js prettyprint-override"><code>[
     {
        &quot;key&quot;:&quot;Company&quot;,
        &quot;text&quot;:&quot;Company&quot;
     },
     {
        &quot;key&quot;:&quot;FirstName&quot;,
        &quot;text&quot;:&quot;First Name&quot;
     },
     {
        &quot;key&quot;:&quot;Lastname&quot;,
        &quot;text&quot;:&quot;Last Name&quot;
     },
     {
        &quot;key&quot;:&quot;StreetAddress&quot;,
        &quot;text&quot;:&quot;Street Address&quot;
     },
     {
        &quot;key&quot;:&quot;City&quot;,
        &quot;text&quot;:&quot;City&quot;
     },
     {
        &quot;key&quot;:&quot;State&quot;,
        &quot;text&quot;:&quot;State&quot;
     },
     {
        &quot;key&quot;:&quot;zip&quot;,
        &quot;text&quot;:&quot;Zip&quot;
     }
  ]
  </code></pre>
  <p>This is wrapped in a Vuejs function:</p>
  <ul>
  <li><code>selected</code> is the original array and</li>
  <li><code>selectedColumns</code> is the array I'm pushing to.</li>
  </ul>
  <pre class="lang-js prettyprint-override"><code>oneToRight: function (e) {
    e.preventDefault();
    this.selected.forEach((el, i) =&gt; {
      this.selectedColumns.push({
        &quot;key&quot;: el.key,
        &quot;text&quot;: el.text
      });
      var del = this.selected.indexOf(this.selected);
      this.selected.splice(del, 1);
    });
  }
  </code></pre>