Return the result (pass/fail) for json file.
174869
def collect_results(results_file):
    """"""
    with open(results_file, 'r') as results:
        data = json.load(results)
    return data
1193719
def get_result(self):
        """"""
        result = get_json_from_remote_server(self.call)
        seconds = self._get_average_duration(result) if result else 0
        return stringify_seconds(seconds)
838996
protected void returnJsonSystemError(HttpServletRequest request, HttpServletResponse response,
            ResultCode resultCode) throws IOException {
        Map<String, Object> errors = new HashMap<String, Object>();
        errors.put(WebResponseConstant.MESSAGE_GLOBAL, resultCode.getMessage().getMessage());
        JsonObject<?> json = JsonObject.create();
        json.setStatus(resultCode.getCode());
        json.setStatusInfo(errors);
        response.setContentType("application/json; charset=UTF-8");
        response.setCharacterEncoding("UTF-8");
        response.getWriter().write(JsonUtils.toJson(json));
    }
659655
def evaluate_response(json_response):
        """"""
        if 'errors' in json_response and json_response['errors']:
            Interface.evaluate_errors(json_response)
        elif 'result' not in json_response:
            raise PyVLXException('no element result  found in response: {0}'.format(json.dumps(json_response)))
        elif not json_response['result']:
            raise PyVLXException('Request failed {0}'.format(json.dumps(json_response)))
1127577
def validate_json(file):
    """"""
    max_file_size = current_app.config.get(
        'PREVIEWER_MAX_FILE_SIZE_BYTES', 1 * 1024 * 1024)
    if file.size > max_file_size:
        return False

    with file.open() as fp:
        try:
            json.loads(fp.read().decode('utf-8'))
            return True
        except:
            return False
688528
def data_json(self, pretty=False):
        """"""
        if pretty:
            return json.dumps(self.data, sort_keys=True, indent=4, separators=(',', ': '))
        else:
            return json.dumps(self.data)
884206
function _response_json_fail(res, envl, message){
    envl.status('failure');
    envl.comments(message);
    return res.json(envl.structure());
}
670747
function validateJSonStructure(filePath, cb) {
  fs.readFile(filePath, function(err, data) {
    if (err) {
      return cb(err);
    }

    try {
      var jsonObject = JSON.parse(data);
      cb(null, jsonObject);
    } catch (e) {
      cb('Invalid JSON file: ' + path.basename(filePath));
    }
  });
}
967885
def result_or_error(response):
    
    data = response.json()
    result = data.get('result')
    if result is not None:
        return result
    raise exceptions.ApiError(response, data)
1369978
def json_success(self, json):
        
        if type(json) is dict and 'result' in json and json['result'] == 'success':
            return True
        return False
33235
def _load_json_file_or_url(self, json_path_or_url):
        '''
        '''
        try:
            if os.path.isfile(json_path_or_url):
                with open(json_path_or_url, 'r') as f:
                    result = json.load(f)
            else:
                res = requests.get(json_path_or_url)
                res.raise_for_status()
                result = res.json()

            return result

        except (ValueError,
                requests.exceptions.RequestException) as e:
            six.raise_from(DataPackageRegistryException(e), e)
599996
def get_results(self, client):
        
        data = self._request('GET', '/results/{}'.format(client))
        return data.json()
503544
def get_json_content(file_path):
    
    try:
        with open(file_path, 'r') as file:
            return json.load(file)
    except TypeError as err:
        print('Error: ', err)
        return None
77838
def json_loads(data):
    """"""
    if data is None:
        return ""

    if data == "-":
        return json.load(sys.stdin)
    elif os.path.exists(data):
        with open(data, 'r') as handle:
            return json.load(handle)
    else:
        return json.loads(data)
590028
def _read_json_file(self):
        
        with open(self.json_uri) as metadata_file:
            try:
                metadata = json.load(metadata_file)
                return metadata
            except ValueError:
                message = tr('the file %s does not appear to be valid JSON')
                message = message % self.json_uri
                raise MetadataReadError(message)
1338326
def json_response(data, status=200):
    """"""
    from django.http import JsonResponse
    return JsonResponse(data=data, status=status, safe=isinstance(data, dict))
735407
def to_output(self, value):
        """"""
        return json.loads(resolwe_runtime_utils.save_file(self.name, value.path, *value.refs))