Generate a json response string.

def _format_json(self, ans, q):
        """
        Generate a json response string.
    """
        params = {}
        try: params['indent'] = int(q.get('indent')[0])
        except: pass

        return json.dumps(ans, **params)+'\n'