def METHOD_NAME(self, result, job):
    json_output = job.config.get("job.run.result.json.output")
    json_enabled = job.config.get("job.run.result.json.enabled")
    if not (json_enabled or json_output):
        return
    if not result.tests_total:
        return
    content = self._render(result)
    if json_enabled:
        json_path = os.path.join(job.logdir, "results.json")
        with open(json_path, "w", encoding="utf-8") as json_file:
            json_file.write(content)
    json_path = json_output
    if json_path is not None:
        if json_path == "-":
            LOG_UI.debug(content)
        else:
            with open(json_path, "w", encoding="utf-8") as json_file:
                json_file.write(content)