compute output in JSON format.
424486
def format(file_metrics, build_metrics):
    """"""
    metrics = {'files': file_metrics}
    if build_metrics:
        metrics['build'] = build_metrics
    body = json.dumps(metrics, sort_keys=True, indent=4) + '\n'
    return body
91339
def json_data(self, instance, default=None):
        
        value = self.get(instance)
        if value:
            return value.output
        return value
1360893
def result(self):
    """"""
    return {
      "count": self._count,
      "total": self._total,
      "average": float(self._total) / self._count if self._count else 0
    }
653670
def json(self):
        """"""
        return {
            "id": self.ID,
            "steps": self.steps,
            "graph_source": self.source,
            "errored": self.errored
        }
595379
def as_json(opts={})
      atts = {
        'id'                => id,
        'color'             => color,
        'status'            => display_status,
        'percent_complete'  => percent_complete,
        'work_units'        => work_units.count,
        'time_taken'        => time_taken
      }
      atts['outputs'] = JSON.parse(outputs) if outputs
      atts['email']   = email               if email
      atts
    end
1087813
function parseOutput(output) {
  if (!output) {
    throw new Error('Expected JSON output');
  }

  let info;
  try {
    info = JSON.parse(String(output));
  } catch (err) {
    throw new Error('Failed to parse output as JSON: ' + output);
  }
  if (!Array.isArray(info.symbols)) {
    throw new Error('Expected symbols array: ' + output);
  }
  if (!Array.isArray(info.defines)) {
    throw new Error('Expected defines array: ' + output);
  }

  return info;
}
746945
def output_json(data, code, headers=None):
    ''''''
    resp = make_response(json.dumps(data), code)
    resp.headers.extend(headers or {})
    return resp
971500
def write_output(self, data, args=None, filename=None, pretty=False):
        """"""
        if args:
            if not args.sojson:
                return 0
            pretty = args.pretty
        if not filename: filename = args.sojson
        if pretty:
            logstring = json.dumps(
                    data['entries'], indent=2, sort_keys=True,
                    separators=(',', ': '))
        else:
            logstring = json.dumps(data['entries'], sort_keys=True)
        
        with open(str(filename), 'w') as output_file:
            output_file.write(logstring)
12150
def json(self):
        """"""
        if self.search_results is None:
            return None

        result = []
        for row in self.search_results['rows']:
            obj = {}
            for index in range(0, len(self.search_results['fields'])):
                obj[self.search_results['fields'][index]] = row[index]
            result.append(obj)

        return result
303250
def json(self):
        """"""
        output = {}
        for filename in self.data:
            output[filename] = []

            for secret_hash in self.data[filename]:
                tmp = self.data[filename][secret_hash].json()
                del tmp['filename']  # Because filename will map to the secrets

                output[filename].append(tmp)

        return output
1130764
def to_json(self):
        """"""
        sets = self.sets()
        return sorted(sorted(x) for x in sets)
91211
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
475129
def getJsonData(self, params):
        
        try:
            return eval("self." + str(params['output_id']) + "(params)")
        except AttributeError:
            df = self.getData(params)
            if df is None:
                return None
            return df.to_dict(orient='records')
759729
def format_output(result, format)
      case format
      when :json
        JSON.pretty_generate(result)
      when :yaml
        YAML.dump(result)
      when :text
        result = result.keys if result.respond_to?(:keys)
        result.join(" ")
      else
        raise ArgumentError, "Unknown output format #{format}"
      end
    end
716022
def maybe_print_as_json(opts, data, page_info=None):
    """"""
    if opts.output not in ("json", "pretty_json"):
        return False

    root = {"data": data}

    if page_info is not None and page_info.is_valid:
        meta = root["meta"] = {}
        meta["pagination"] = page_info.as_dict(num_results=len(data))

    if opts.output == "pretty_json":
        dump = json.dumps(root, indent=4, sort_keys=True)
    else:
        dump = json.dumps(root, sort_keys=True)

    click.echo(dump)
    return True
592252
function encodeOutputToJson(output) {
    var book = output.getBook();
    var generator = output.getGenerator();
    var options = output.getOptions();

    var result = encodeBook(book);

    result.output = {
        name: generator
    };

    result.options = options.toJS();

    return result;
}
161072
def values(self):
        """"""
        for _, task in self._tasks:
            if not (task and task.result):
                yield None
            else:
                yield json.loads(task.result)["payload"]