mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-11 05:49:22 +00:00
refactor: The first refactored version for sdk release (#907)
Co-authored-by: chengfangyin2 <chengfangyin3@jd.com>
This commit is contained in:
14
dbgpt/util/json_utils.py
Normal file
14
dbgpt/util/json_utils.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import json
|
||||
from datetime import date, datetime
|
||||
|
||||
|
||||
def serialize(obj):
|
||||
if isinstance(obj, date):
|
||||
return obj.isoformat()
|
||||
|
||||
|
||||
class DateTimeEncoder(json.JSONEncoder):
|
||||
def default(self, obj):
|
||||
if isinstance(obj, datetime):
|
||||
return obj.isoformat()
|
||||
return super().default(obj)
|
Reference in New Issue
Block a user