기저질환 선택(set)
위 자료형은 json 파일로 따로 변환이 안되는 상황입니다.
json 모듈을 수정하여 문제를 해결했으며, 실행 환경에서는 이 부분이 수정되어야 할 것 같습니다.
수정된 코드는 python3.12/json 밑의 encoder.py이며, 수정사항은 다음과 같습니다.
def default(self, o):
"""Implement this method in a subclass such that it returns
a serializable object for o, or calls the base implementation
(to raise a TypeError).
For example, to support arbitrary iterators, you could
implement default like this::
def default(self, o):
try:
iterable = iter(o)
except TypeError:
pass
else:
return list(iterable)
# Let the base class default method raise the TypeError
return super().default(o)
"""
if isinstance(o, set):
return list(o)
if isinstance(o, datetime.date):
return o.strftime('%Y-%m-%d')
raise TypeError(f'Object of type {o.__class__.__name__} '
f'is not JSON serializable')
### 프론트엔드용 json 모듈 수정
현재 model의 다음 input값 자료형이 date, set입니다.
수정된 코드는 python3.12/json 밑의 encoder.py이며, 수정사항은 다음과 같습니다. def default(self, o): """Implement this method in a subclass such that it returns a serializable object for
o
, or calls the base implementation (to raise aTypeError
).