I am trying to convert the following Javascript object into valid JSON:
[{
'"Sno"': '"1"',
'"Purchase Date Time"': '"2017-11-14 14:09:32"',
'"Txn Type"': '"COD"',
'"Order Status"': '"DELIVERED"'
},
{
'"Sno"': '"2"',
'"Purchase Date Time"': '"2017-11-14 14:09:32"',
'"Txn Type"': '"COD"',
'"Order Status"': '"DELIVERED"'
}]
I have already tried JSON.stringify()
but it gives result as:
"[{"\"Sno\"":"\"1\"","\"Purchase Date Time\"":"\"2017-11-10 14:09:32\"","\"Txn Type\"":"\"COD\"","\"Order Status\"":"\"DELIVERED\"",}]"
This way I am unable to access the individual elements.
I want access the value like objectName[i].Sno
.
How can I do that?