当 return 空值时 JSON.stringify 日期转换为 JSON.parse

JSON.stringify date convert into JSON.parse when return empty value

我使用 JSON.stringify() 将一个对象转换为 json 字符串,然后我需要使用 JSON.parse() 的相同对象,但我得到的数组值为空,如何获取原始数据,请帮助解决这个问题, 在下面的代码中是字符串化数据

{
"agefrom":18,
"ageto":60,
"heightfrom":"1",
"heightto":"28",
"steps":["Never","One"],
"number":["One","two "],
"education":["B.E","B.E / B.Tech"]
}

以下数据转换成JSON.parse

 {
        "agefrom":18,
        "ageto":60,
        "heightfrom":"1",
        "heightto":"28",
        "steps":"",
        "number":"",
        "education":""
   }

fiddle 试试这个 fiddle。它对我来说很好。

 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))