convert string to var object in JavaScript

  • Thread starter Thread starter Soulidentities
  • Start date Start date
S

Soulidentities

Guest
Hi

I am developing a windows application in C#. I have a form with webbrowser control. In the webbrowser control there is a javascript which is below with,


<Script>
var str = `{"title": "Mr", "Name": "Samy", "Age": "30", "Gender": "Male"};
{"title": "Mrs", "Name": "Sully", "Age": "25", "Gender": "Female"};
{"title": "Mr", "Name": "John", "Age": "35", "Gender": "Male"};
{"title": "Mr", "Name": "Amy", "Age": "32", "Gender": "Female"}`;

const data = str.split(';').map((obj) => JSON.parse(obj));
alert(data);
</Script>

//Output will be
[object Object], [object Object], [object Object], [object Object]



My problem is, it is not working in windows application, it shows "script error" in the line of "var str....". but it works in asp.net web application. Please help me to solve this.

Thanks

Continue reading...
 
Back
Top