In utils.py,

import ujson from aiohttp import web def json_response(data, **kwargs): # Sometimes user needs to override default content type for JSON kwargs.setdefault('content_type', 'application/json') return web.Response(ujson.dumps(data), **kwargs)

Note: I recommend to use ujson for work with JSON data in Python, cause of speed.