Can comments be used in JSON?

后端 未结 30 2091
别跟我提以往
别跟我提以往 2020-11-22 02:16

Can I use comments inside a JSON file? If so, how?

30条回答
  •  天涯浪人
    2020-11-22 02:53

    If your text file, which is a JSON string, is going to be read by some program, how difficult would it be to strip out either C or C++ style comments before using it?

    Answer: It would be a one liner. If you do that then JSON files could be used as configuration files.

提交回复
热议问题