import json import re from constants import REPLACE_COMMENT_REGEX class JSONParser: __json_str: str = None def __init__(self, json_str: str) -> None: self.__json_str = json_str def parse(self): # コメントを除去して辞書に変換する without_comment = re.sub(REPLACE_COMMENT_REGEX, '', self.__json_str) return json.loads(without_comment)