mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-25 06:26:37 +00:00
Create json.py
This commit is contained in:
parent
5ab4e41b8d
commit
a00d760f04
16
tubesync/common/json.py
Normal file
16
tubesync/common/json.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
from django.core.serializers.json import DjangoJSONEncoder
|
||||||
|
|
||||||
|
|
||||||
|
class JSONEncoder(DjangoJSONEncoder):
|
||||||
|
item_separator = ','
|
||||||
|
key_separator = ':'
|
||||||
|
|
||||||
|
def default(self, obj):
|
||||||
|
try:
|
||||||
|
iterable = iter(obj)
|
||||||
|
except TypeError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
return list(iterable)
|
||||||
|
return super().default(obj)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user