Skip to content

Commit

Permalink
Switch to using native json module
Browse files Browse the repository at this point in the history
  • Loading branch information
russss committed Sep 19, 2023
1 parent 9043d50 commit 1d5a7f7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions apps/common/json_export.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from simplejson import JSONEncoder
from decimal import Decimal
from json import JSONEncoder
from datetime import datetime
from collections import OrderedDict

from sqlalchemy.engine.row import Row
from main import db
from models import to_dict

Expand All @@ -11,6 +12,12 @@ def default(self, obj):
if isinstance(obj, datetime):
return obj.isoformat(" ")

if isinstance(obj, Decimal):
return str(obj)

if isinstance(obj, Row):
return tuple(obj)

return JSONEncoder.default(self, obj)

def iterencode(self, obj):
Expand Down

0 comments on commit 1d5a7f7

Please sign in to comment.