Eclipse Neon Json editor - allow comments

前端 未结 1 1389
别那么骄傲
别那么骄傲 2021-02-20 10:46

Is it possible to allow comments in JSON file?

I have a JSON file with comment lines marked with // on the beginning. The file is properly read by com

1条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-20 11:11

    Because the JSON format is very simple, Eclipse's built-in JSON validation doesn't provide any granular control over what is marked as an error.

    I see two options:

    1. Use pseudo-comments as described here.
    2. Disable JSON validation for that specific file.
      • Window > Preferences > Validation
      • In the 'Validator' list, find "JSON Validator" and click the '...' in the Settings column
      • Add an exclude group, then add a rule for the specific file you want the validator to ignore

    As an aside, the JSON format doesn't support any kind of comment notation. Strictly speaking, that error message is correct - but in this case the parser you're using (Jackson) is configured to allow something out-of-spec.

    0 讨论(0)
提交回复
热议问题