# Path: blitzdb/backends/file/utils.py
# class JsonEncoder(json.JSONEncoder):
# 
#     def default(self, obj):
#         if isinstance(obj, set):
#             return list(obj)
#         elif isinstance(obj, datetime.datetime):
#             return obj.ctime()
#         return json.JSONEncoder.default(self, obj)


import json
import six
    import pickle as cPickle
    import cPickle
    import cjson
from blitzdb.backends.file.utils import JsonEncoder



if six.PY3:
else:

"""
Serializers take a Python object and return a string representation of it.
BlitzDB currently supports several differen JSON serializers,
as well as a cPickle serializer.
"""


class JsonSerializer(object):

    @classmethod
    def serialize(cls, data):
        if six.PY3:
            if isinstance(data, bytes):

# Path: blitzdb/backends/file/utils.py
# class JsonEncoder(json.JSONEncoder):
# 
#     def default(self, obj):
#         if isinstance(obj, set):
#             return list(obj)
#         elif isinstance(obj, datetime.datetime):
#             return obj.ctime()
#         return json.JSONEncoder.default(self, obj)


# Path: blitzdb/backends/file/serializers.py
import json
import six
    import pickle as cPickle
    import cPickle
    import cjson
from blitzdb.backends.file.utils import JsonEncoder




if six.PY3:
else:

"""
Serializers take a Python object and return a string representation of it.
BlitzDB currently supports several differen JSON serializers,
as well as a cPickle serializer.
"""


class JsonSerializer(object):

    @classmethod
    def serialize(cls, data):
        if six.PY3:
            if isinstance(data, bytes):

                return json.dumps(data.decode('utf-8'), cls=JsonEncoder,ensure_ascii = False).encode('utf-8')