javascript - Webstorm creates json file problem
巴扎黑
巴扎黑 2017-06-05 11:13:00
0
2
1099

In Figure 1, when there are no variables, the file is OK

In Figure 2, when something like a={} appears, an error is reported. What I actually want is something like this
, like this, as follows

巴扎黑
巴扎黑

reply all (2)
漂亮男人

json has strict requirements on the format. You cannot add = directly to the json file. You must follow the format of "key":.... You can assign the obtained json object to a variable in js

    漂亮男人

    The json format is wrong. You can copy this object to a js file and use JSON.stringify to convert it and then copy it to the json file:
    var obj={a:1,b:2,'c':[1 ,2],'d':{c:[2,34,4]}}
    JSON.stringify(obj)==>"{"a":1,"b":2,"c":[ 1,2],"d":{"c":[2,34,4]}}"

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!