How can I read JSON content with a comment with Json.NET?

后端 未结 3 1304
星月不相逢
星月不相逢 2020-12-17 07:47

In order to install an external extension into Google Chrome browser, I try to update a Chrome external extension JSON file. Using Json.NET it seems to be easy:

3条回答
  •  时光说笑
    2020-12-17 08:22

    You could always convert single-line comments to multi-line comment syntax before parsing...

    Something like replace...

    .*//.*\n
    

    with

    $1/*$2*/
    

    ...

    Regex.Replace(subjectString, ".*//.*$", "$1/*$2*/");
    

提交回复
热议问题