Create json.py

This commit is contained in:
tcely 2025-05-08 23:07:12 -04:00 committed by GitHub
parent 5ab4e41b8d
commit a00d760f04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

16
tubesync/common/json.py Normal file
View 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)