admin管理员组文章数量:1415145
I am using IntelliJ IDEA 14 for a web project, where I want to keep a file a.js
containing a JSON object. The content of the a.js
is
{
"ac" : "abc",
"d" : 4,
"_constants": {}
}
While editing this file, IntelliJ keeps reminding me that this file has syntactic errors. It makes a hints after "ac", "d" and "_constants", before the semicolon, saying "Expecting newline or semicolon".
Does not IntelliJ IDEA accept a file containing a JSON object as a legitimate javascript file?
I am using IntelliJ IDEA 14 for a web project, where I want to keep a file a.js
containing a JSON object. The content of the a.js
is
{
"ac" : "abc",
"d" : 4,
"_constants": {}
}
While editing this file, IntelliJ keeps reminding me that this file has syntactic errors. It makes a hints after "ac", "d" and "_constants", before the semicolon, saying "Expecting newline or semicolon".
Does not IntelliJ IDEA accept a file containing a JSON object as a legitimate javascript file?
Share Improve this question edited Feb 25, 2015 at 14:34 gefei asked Feb 25, 2015 at 14:24 gefeigefei 19.9k9 gold badges54 silver badges70 bronze badges2 Answers
Reset to default 5IntelliJ has a separate file type for JSON files. It will be applied if you rename your file from a.js to a.json.
You can add file pattern to your settings
Settings->Editor->File Types->Json
For example "json-config-*.js"
本文标签: javascriptIntelliJ IDEA json file syntaxStack Overflow
版权声明:本文标题:javascript - IntelliJ IDEA: json file syntax - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745199863a2647319.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论