def list_pool(self):
        """ List pools and return JSON encoded result.
        """

        # fetch attributes from request.json
        attr = XhrController.extract_pool_attr(request.json)

        try:
            pools = Pool.list(attr)
        except NipapError, e:
            return json.dumps({'error': 1, 'message': e.args, 'type': type(e).__name__})

        return json.dumps(pools, cls=NipapJSONEncoder)
List pools and return JSON encoded result.