How to parse json file with c-style comments?

后端 未结 5 1331
無奈伤痛
無奈伤痛 2020-12-03 10:19

I have a json file, such as the following:

    { 
       \"author\":\"John\",
       \"desc\": \"If it is important to decode all valid JSON correctly \\ 
an         


        
5条回答
  •  北海茫月
    2020-12-03 10:42

    I have not personally used it, but the jsoncomment python package supports parsing a JSON file with comments.

    You use it in place of the JSON parser as follows:

    parser = JsonComment(json)
    parsed_object = parser.loads(jsonString)
    

提交回复
热议问题