docs: def to_json(self, obj, host=None, indent=None):
          """Recursively encode `obj` and convert it to a JSON string.
  
          :param obj:
              Object to encode.
  
          :param host:
              hostname where this object is being encoded.
          :type host: str"""
          if indent:
              return json.dumps(deep_map(lambda o: self.encode(o, host), obj),
                                indent=indent)
          else:
              return json.dumps(deep_map(lambda o: self.encode(o, host), obj))