Skip to content

Commit 5b4065e

Browse files
committed
manage uuid object in json encoder
1 parent a7e1d45 commit 5b4065e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

flask_rest_jsonapi/utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
# -*- coding: utf-8 -*-
22

33
import json
4+
from uuid import UUID
45
from datetime import datetime
56

67

78
class JSONEncoder(json.JSONEncoder):
89
def default(self, obj):
910
if isinstance(obj, datetime):
1011
return obj.isoformat()
12+
elif isinstance(obj, UUID):
13+
return str(obj)
1114
return json.JSONEncoder.default(self, obj)

0 commit comments

Comments
 (0)