# Path: app.py



import os
import sys
import calendar
from datetime import datetime
from flask import jsonify
from flask.json import JSONEncoder
from app import app

    Custom Flask JSONEncoder
    http://flask.pocoo.org/snippets/119/
"""

sys.path.insert(0, os.path.dirname(os.path.abspath(os.path.dirname(__file__))))




class CustomJSONEncoder(JSONEncoder):
    
    def default(self, obj):
        try:
            if isinstance(obj, datetime):
                if obj.utcoffset() is not None:
                    obj = obj - obj.utcoffset()
                millis = int(
                    calendar.timegm(obj.timetuple()) * 1000 +
                    obj.microsecond / 1000
                )
                return millis
            iterable = iter(obj)
        except TypeError:
            pass
        else:
            return list(iterable)
        return JSONEncoder.default(self, obj)



# Path: app.py



# Path: utilities/json_encoder.py
import os
import sys
import calendar
from datetime import datetime
from flask import jsonify
from flask.json import JSONEncoder
from app import app


    Custom Flask JSONEncoder
    http://flask.pocoo.org/snippets/119/
"""

sys.path.insert(0, os.path.dirname(os.path.abspath(os.path.dirname(__file__))))




class CustomJSONEncoder(JSONEncoder):
    
    def default(self, obj):
        try:
            if isinstance(obj, datetime):
                if obj.utcoffset() is not None:
                    obj = obj - obj.utcoffset()
                millis = int(
                    calendar.timegm(obj.timetuple()) * 1000 +
                    obj.microsecond / 1000
                )
                return millis
            iterable = iter(obj)
        except TypeError:
            pass
        else:
            return list(iterable)
        return JSONEncoder.default(self, obj)



app.json_encoder = CustomJSONEncoder