Hi all I am framing a string as per my requirement
var empID=1;
var empName='XYZ';
var vData="ID=" + empID+ ";" + "Name=" + empName+ ";" // here I will read the data from the form on clicking the button the above is sample data
I need to convert this to string array I tried using JSON.parse but it is giving me some exception as Uncaught SyntaxError: Unexpected token S
var varray = JSON.parse("[" + vData + "]");
So can some one tell me how can I convert my data to an array so that is should be like
var items = [
{ ID: 1, Name: xyz },
{ ID: 2, Name: PQR },
]
"{ID:..,Name:..}"json.orgJSON.parse()or use your own format and write your own parser for it!2andPQRfrom?JSON.parseis just silly. write the JSON you want without quotes, and you'll have what you need