如何避免 Chrome 在解析此 JSON 时崩溃?

ale*_*der 6 html javascript json google-chrome

我创建了一个非常简单的网页,它只是解析一些 JSON 字符串,但不知何故浏览器总是崩溃。我使用 Chrome 80.0.3987.132。我用验证器测试了字符串,它确保它是有效的 JSON。如何调试我的代码以查看它失败的原因?有没有办法在不失败的情况下解析 JSON?

结果是 Chrome 80.0.3987.132(在 Ubuntu 上): 在此处输入图片说明

<!DOCTYPE html>
<html>
<body>

<h1>Can Chrome parse JSON?</h1>

<script>
var my_json = `{
   "base":[
      {
         "params":{
            "list":[
               {
                  "description":"bla",
                  "max":0.5,
                  "min":0.0,
                  "name":"bla",
                  "stepsize":0.01,
                  "type":"float",
                  "unit":"M"
               },
               {
                  "description":"bla",
                  "max":null,
                  "min":null,
                  "name":"bla",
                  "params":[
                     {
                        "description":"bla",
                        "max":15,
                        "min":5,
                        "name":"bla",
                        "stepsize":0.1,
                        "type":"float",
                        "unit":null
                     },
                     {
                        "description":"bla",
                        "max":15,
                        "min":0.1,
                        "name":"bla",
                        "stepsize":0.01,
                        "type":"float",
                        "unit":null
                     }
                  ],
                  "type":"ARRAY",
                  "unit":null
               }
            ]
         }
      }
   ]
}`
JSON.parse(my_json)
</script>

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

AMA*_*AMA -1

实际上这真的很奇怪,但是如果你删除第二个"unit":null它就会起作用,我不知道为什么,但是尝试这个 JSON:

{
  "base": [
    {
      "params": {
        "list": [
          {
            "description": "bla",
            "max": 0.5,
            "min": 0,
            "name": "bla",
            "stepsize": 0.01,
            "type": "float",
            "unit": "M"
          },
          {
            "description": "bla",
            "max": null,
            "min": null,
            "name": "bla",
            "params": [
              {
                "description": "bla",
                "max": 15,
                "min": 5,
                "name": "bla",
                "stepsize": 0.1,
                "type": "float",
                "unit": null
              },
              {
                "description": "bla",
                "max": 15,
                "min": 0.1,
                "name": "bla2",
                "stepsize": 1,
                "type": "float"
              }
            ],
            "type": "ARRAY",
            "unit": null
          }
        ]
      }
    }
  ]
}
Run Code Online (Sandbox Code Playgroud)