I have a object convert into json string using JSON.stringify() and then I need same object with using of JSON.parse(), but I get array values are empty, how to I get original data, please help to solve this issue, in below codes is stringify data
{
"agefrom":18,
"ageto":60,
"heightfrom":"1",
"heightto":"28",
"steps":["Never","One"],
"number":["One","two "],
"education":["B.E","B.E / B.Tech"]
}
below data after convert into JSON.parse
{
"agefrom":18,
"ageto":60,
"heightfrom":"1",
"heightto":"28",
"steps":"",
"number":"",
"education":""
}
fiddle try this fiddle. it works fine for me.
a = {
"agefrom": 18,
"ageto": 60,
"heightfrom": "1",
"heightto": "28",
"steps": ["Never", "One"],
"number": ["One", "two "],
"education": ["B.E", "B.E / B.Tech"]
}
a = JSON.stringify(a)
document.write(a);
b = JSON.parse(a);
document.write(JSON.stringify(b))