checks if a string may be a json and contains a error string somewhere, this is used for speedup the error parsing

@param json
972088
protected void skipResponseStatusExceptionParsing(String json) throws ResponseErrorJsonParsingException {
    // If this is not an object, it's not an error response.
    if (!json.startsWith("{")) {
      throw new ResponseErrorJsonParsingException();
    }

    int subStrEnd = Math.min(50, json.length());
    if (!json.substring(0, subStrEnd).contains("\"error\"")) {
      throw new ResponseErrorJsonParsingException();
    }
  }
1080070
function jsonKeyExists(json, key) {
  var keys = key.split('.')
  var cur = json

  for (var i = 0; i < keys.length; i++) {
    try {
      cur = cur[keys[i]]
      if (cur === undefined) return false
    } catch(e) {
      return false
    }
  }

  return true
}
221763
public static function isJson($string){

        if(!is_string($string)) return false;

        if(empty($string)) return false;

        json_decode($string);
        return (json_last_error() == JSON_ERROR_NONE);
    }
1228828
private function validateSyntax($json)
    {
        $parser = new JsonParser();
        $result = $parser->lint($json);
        if ($result === null) {
            return;
        }

        throw new ParsingException(sprintf("The configuration file \"%s\" does not contain valid JSON.\n%s", $this->configurationFile, $result->getMessage()), $result->getDetails());
    }
582259
function isJSONStr(value) {
    if (!lodash.isString(value)) {
        return false;
    }
    try {
        return isJSONObj(JSON.parse(value));
    } catch (e) {
        return false;
    }
}
893583
public void readJson(@Nullable final JsonObject json) {
    if (null == json) return;
    min = json.get("min").getAsDouble();
    max = json.get("max").getAsDouble();
    negatives = json.get("negatives").getAsInt();
    positives = json.get("positives").getAsInt();
    zeros = json.get("zeros").getAsInt();
    sum0 = json.get("sum0").getAsInt();
    sum1 = json.get("sum1").getAsDouble();
    sum2 = json.get("sum2").getAsDouble();
    sumLog = json.get("sumLog").getAsDouble();
  }
1030935
public void showJson(String json) {
		try {
			JsonFactory jsonFactory = new JsonFactory();
			ObjectMapper objectMapper = new ObjectMapper();
			StringWriter stringWriter = new StringWriter();

			JsonParser jsonParser = jsonFactory.createJsonParser(new StringReader(json));
			JsonNode jsonNode = objectMapper.readTree(jsonParser);
			JsonGenerator jsonGenerator = jsonFactory.createJsonGenerator(stringWriter);
			jsonGenerator.useDefaultPrettyPrinter();

			objectMapper.writeTree(jsonGenerator, jsonNode);

			jsonGenerator.flush();
			jsonGenerator.close();
		} catch (Throwable throwable) {
			// hmm, somewhat accidentally crashed?
		}
	}
1120973
public static boolean isJsonRequest(ServletRequest request) {

        HttpServletRequest sr = (HttpServletRequest)request;
        return (sr.getQueryString() != null) && (sr.getQueryString().contains("__json=true"));
    }
609896
public String getStringFrom(JsonValue json) {
    if (json.isString()) {
      return json.asString();
    } else {
      return json.toString();
    }
  }
1369598
def check_json(json_type):
        
        try:
            str_types = (str, unicode)
        except NameError:
            str_types = (str,)

        if type(json_type) == dict:
            return json_type
        elif type(json_type) in str_types:
            return json.loads(json_type)
        else:
            raise ValueError("json_type should be a json dict or string.")
1253745
def is_json(self, headers):
        """"""
        ret = False
        ct = headers.get("content-type", "").lower()
        if ct:
            ret = ct.lower().rfind("json") >= 0
        return ret
760658
public static Fault createFromJson(String json) {
		Fault fault = new Fault(null, 0);
		try (JsonReader reader = Json.createReader(new StringReader(json))) {
			JsonObject root = reader.readObject();
			fault.message = root.getString(Constants.Message.Fault.MESSAGE);
			fault.classname = root.getString(Constants.Message.Fault.CLASSNAME);
		}
		return fault;
	}
172169
def json_exception(context, request):
    """"""
    request.response.status = context.code
    return {'error': context._status, 'messages': context.message}
844321
protected JsonObject silentlyCreateObjectFromString(String json) {
    JsonObject errorObject = null;

    // We need to swallow exceptions here because it's possible to get a legit
    // Facebook response that contains illegal JSON (e.g.
    // users.getLoggedInUser returning 1240077) - we're only interested in
    // whether or not there's an error_code field present.
    try {
      errorObject = Json.parse(json).asObject();
    } catch (ParseException e) {
      // do nothing here
    }

    return errorObject;
  }
97329
def is_json(self) -> bool:
        """"""
        content_type = self.mimetype
        if content_type == 'application/json' or (
                content_type.startswith('application/') and content_type.endswith('+json')
        ):
            return True
        else:
            return False
296451
def _is_json(string):
        
        try:
            if isinstance(string, bytes):
                json_str = json.loads(string.decode("utf-8"), object_pairs_hook=OrderedDict)
            elif isinstance(string, str):
                json_str = json.loads(string, object_pairs_hook=OrderedDict)
            else:
                raise TypeError("Expecting <class 'str'> or <class 'bytes'>, but {} was passed".format(type(string)))
            return json_str
        except ValueError:
            return False
57963
function isJson(str) {
        try {
            var obj = JSON.parse(str);
            return this.isObject(obj);
        } catch (e) {/* ignore */}

        return false;
    }