import types

from cyclone import escape
from cyclone import web

class OONIBHandler(web.RequestHandler):
    def write(self, chunk):
        """
        This is a monkey patch to RequestHandler to allow us to serialize also
        json list objects.
        """
        if isinstance(chunk, types.ListType):
            chunk = escape.json_encode(chunk)
            web.RequestHandler.write(self, chunk)
            self.set_header("Content-Type", "application/json")
        else:
            web.RequestHandler.write(self, chunk)

class OONIBError(web.HTTPError):
    pass

from cyclone import web

class OONIBHandler(web.RequestHandler):
    pass

class OONIBError(web.HTTPError):
    pass

--- 
+++ 
@@ -1,7 +1,20 @@
+import types
+
+from cyclone import escape
 from cyclone import web
 
 class OONIBHandler(web.RequestHandler):
-    pass
+    def write(self, chunk):
+        """
+        This is a monkey patch to RequestHandler to allow us to serialize also
+        json list objects.
+        """
+        if isinstance(chunk, types.ListType):
+            chunk = escape.json_encode(chunk)
+            web.RequestHandler.write(self, chunk)
+            self.set_header("Content-Type", "application/json")
+        else:
+            web.RequestHandler.write(self, chunk)
 
 class OONIBError(web.HTTPError):
     pass
Add support for serializing lists to json via self.write()
