mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Correctly JSON serialize sqlite3.Cursor
This commit is contained in:
parent
bc9379aabc
commit
5f806880c9
1 changed files with 2 additions and 0 deletions
2
app.py
2
app.py
|
|
@ -288,6 +288,8 @@ class CustomJSONEncoder(json.JSONEncoder):
|
|||
def default(self, obj):
|
||||
if isinstance(obj, sqlite3.Row):
|
||||
return tuple(obj)
|
||||
if isinstance(obj, sqlite3.Cursor):
|
||||
return list(obj)
|
||||
if isinstance(obj, bytes):
|
||||
# Does it encode to utf8?
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue