code: def _format_json(self, ans, q):
          
          params = {}
          try: params['indent'] = int(q.get('indent')[0])
          except: pass
  
          return json.dumps(ans, **params)+'\n'
docs: Generate a json response string.