You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

jsonutil.py 234B

1234567891011
  1. import json
  2. from pydantic import BaseModel
  3. class PydanticModelEncoder(json.JSONEncoder):
  4. def default(self, o):
  5. if isinstance(o, BaseModel):
  6. return o.model_dump()
  7. else:
  8. super().default(o)