2022-07-12 15:55:59 +09:00

18 lines
399 B
Python

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)