How to solve/fix JSON.parse problem dealing with duplicates

How to solve/fix JSON.parse problem dealing with duplicates

Hi all 

I seem to be facing this problem :  JSON syntax duplicates

This is the source xls file format:


This is the JSON : 
  1. [{"Registrant ID":"22722608","Registrant Date":"09/18/2018","Last Name":"Armstrong","First Name":"Conor","Email":"conor.armstrong@testco.com","Username":"conor.armstrong@testco.com","Company":"TEST CO","Department":"","Title":"","Attendee":"No","Status":"Enrolled","Section":"","Location":"place online"},{"Registrant ID":"22722608","Registrant Date":"09/18/2018","Last Name":"jenkins","First Name":"bob","Email":"bob.jenkins@testco.com","Username":"bob.jenkins@testco.com","Company":"TEST CO","Department":"","Title":"","Attendee":"No","Status":"Enrolled","Section":"","Location":"place online"}]
Here's my fiddle :

As a simple test using only part of the JSON this works fine :
  1. <!DOCTYPE html>
  2. <html>
  3. <body>

  4. <h2>Create Object from JSON String</h2>

  5. <p id="filtered"></p>

  6. <script>
  7. var txt = '{"Registrant ID":"22722608","Registrant Date":"09/18/2018","Last Name":"Armstrong","First Name":"Conor","Email":"conor.armstrong@testco.com","Username":"conor.armstrong@testco.com","Company":"TEST CO","Department":"","Title":"","Attendee":"No","Status":"Enrolled","Section":"","Location":"place online"}'
  8. var obj = JSON.parse(txt);
  9. document.getElementById("filtered").innerHTML = obj['Last Name'] + ", " + obj.Location;
  10. </script>

  11. </body>
  12. </html>
How can I go about solving this ? Is there a way to filter the uploaded XLS file before creating a JSON object?

In a nutshell the above code :
1.uploads an XLS file (demo roster 1 ...attached in this post too )
2.creates a (hopefully filtered JSON object) 
3.will finally save as a CSV (On my WISHLIST now)

Is it because the object is an array and I should be dealing with it differently , if so please advise/correct me.



I look forward to any help or advice.

Thank you 

Den