Weird JSON parsing behavior in js, “Unexpected token :”

后端 未结 3 650
傲寒
傲寒 2020-12-23 20:22

As demonstrated in this jsfiddle, if you have a JS file and you create a JSON object without using it, it behaves differently depending on whether the keys(members) are wrap

3条回答
  •  时光取名叫无心
    2020-12-23 21:00

    I just realized than when loading the JSON via require and the filename does not end on .json i get this error. Renaming the file to bla.json and it works fine.

提交回复
热议问题