json.stringify日期转换为json.parse当返回空值时



我使用json.stringify()将对象转换为json字符串,然后我需要使用JSON.PARSE()的对象,但是我得到的数组值为空,我得到了原始数据,请帮助解决此问题,在下面的代码中是Stringify Data

{
"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":""
   }

小提琴尝试这个小提琴。它对我来说很好。

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

最新更新