code: def to_json(self):
      
      result = {
          "mapper_handler_spec": self.handler_spec,
          "mapper_input_reader": self.input_reader_spec,
          "mapper_params": self.params,
          "mapper_shard_count": self.shard_count
      }
      if self.output_writer_spec:
        result["mapper_output_writer"] = self.output_writer_spec
      return result
docs: Serializes this MapperSpec into a json-izable object.