javascript - IntelliJ IDEA: json file syntax - Stack Overflow

I am using IntelliJ IDEA 14 for a web project, where I want to keep a file a.js containing a JSON objec

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 badges
Add a ment  | 

2 Answers 2

Reset to default 5

IntelliJ 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"

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745199864a4616272.html

相关推荐

  • javascript - IntelliJ IDEA: json file syntax - Stack Overflow

    I am using IntelliJ IDEA 14 for a web project, where I want to keep a file a.js containing a JSON objec

    5小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信