JSON result format
9609
function(){
		var self = this;

		return {
			name: self.nsPath.split( '.' ).pop(),
			nsPath: self.nsPath,
			count: self.count,
			passed: self.passed,
			failed: self.failed,
			skipped: self.skipped,
			start: self.start,
			end: self.end,
			time: self.end - self.start,
			tests: self.list,
			ns: self.ns,
		};
	}
1032081
function returnJSON(finalResp, res) {
    if (JSONformat === 'JSON') {
      res.set('Content-Type', `application/json; charset=${encoding}`);
      res.json(finalResp);
    } else {
      res.set('Content-Type', `text/plain; charset=${encoding}`);
      res.send(JSON.stringify(finalResp));
    }
  }
942044
public static String successfulJson(Object data) {
        ReturnData returnData = new ReturnData();
        returnData.setSuccess(true);
        returnData.setErrorCode(200);
        returnData.setData(data);
        return JSON.toJSONString(returnData);
    }
1267619
public function jsonVal()
    {
        $json = $this->propertyVal();
        if (!is_string($json)) {
            $json = json_encode($json);
        }
        if (!$json || $json == 'null') {
            $json = '';
        }
        return $json;
    }
49813
def format_to_json(data):
    
    if sys.stdout.isatty():
        return json.dumps(data, indent=4, separators=(',', ': '))
    else:
        return json.dumps(data)
736946
function encodeResult (result, count) {
    var output = '';
    output += (result.ok ? 'ok ' : 'not ok ') + count;
    output += result.message ? ' ' + result.message.toString().replace(/\s+/g, ' ') : '';

    if (result.skip) output += ' # SKIP';
    else if (result.todo) output += ' # TODO';

    output += '\n';
    if (result.ok) return output;

    var outer = '  ';
    var inner = outer + '  ';
    output += outer + '---\n';
    output += inner + 'operator: ' + result.operator + '\n';

    var ex = JSON.stringify(result.expected) || '';
    var ac = JSON.stringify(result.actual) || '';

    if (Math.max(ex.length, ac.length) > 65) {
        output += inner + 'expected:\n' + inner + '  ' + ex + '\n';
        output += inner + 'actual:\n' + inner + '  ' + ac + '\n';
    }
    else {
        output += inner + 'expected: ' + ex + '\n';
        output += inner + 'actual:   ' + ac + '\n';
    }
    if (result.at) {
        output += inner + 'at: ' + result.at + '\n';
    }
    if (result.operator === 'error' && result.actual && result.actual.stack) {
        var lines = String(result.actual.stack).split('\n');
        output += inner + 'stack:\n';
        output += inner + '  ' + lines[0] + '\n';
        for (var i = 1; i < lines.length; i++) {
            output += inner + lines[i] + '\n';
        }
    }

    output += outer + '...\n';
    return output;
}
301986
def format_results(self, results):
        
        if not results:
            return None
        userdn = results[0][0]
        userobj = results[0][1]
        userobj['dn'] = userdn

        keymap = self.config.get('KEY_MAP')
        if keymap:
            return {key:scalar(userobj.get(value)) for key, value in keymap.items() if _is_utf8(scalar(userobj.get(value))) }
        else:
            return {key:scalar(value) for key, value in userobj.items() if _is_utf8(scalar(value)) }
1307202
def json_pretty_print(s):
    ''''''
    s = json.loads(s)
    return json.dumps(s,
                      sort_keys=True,
                      indent=4,
                      separators=(',', ': '))
1085620
public static String formatJson(String json) {
    assertInitialization();
    return XLog.sLogConfiguration.jsonFormatter.format(json);
  }
982414
def json_data(self):
        """"""
        return {
            "type": self.type,
            "origin_id": self.origin_id,
            "network_id": self.network_id,
            "contents": self.contents,
        }
417235
def json(self):
        
        json_string = json.dumps(
            self.scores,
            indent=2,
            allow_nan=True
        )
        return json_string
288133
def json_loads(data):
    
    try:
        return json.loads(data, encoding='utf-8')
    except TypeError:
        return json.loads(data.decode('utf-8'))
511196
def json(self, start=None):
        
        if start is not None:
            data = self.data[start]
        return json.dumps(self.data, indent=4)
486824
def tojson(val, indent=None):
    '''
    
    '''
    options = {'ensure_ascii': True}
    if indent is not None:
        options['indent'] = indent
    return (
        salt.utils.json.dumps(
            val, **options
        ).replace('<', '\\u003c')
         .replace('>', '\\u003e')
         .replace('&', '\\u0026')
         .replace("'", '\\u0027')
    )
365453
def output_json(gandi, format, value):
    
    if format == 'json':
        gandi.echo(json.dumps(value, default=date_handler, sort_keys=True))
    elif format == 'pretty-json':
        gandi.echo(json.dumps(value, default=date_handler, sort_keys=True,
                              indent=2, separators=(',', ': ')))
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
579178
def json_dumps(self, obj):
        """"""
        return json.dumps(obj, sort_keys=True, indent=4, separators=(',', ': '))