Fails if selected JSON is  null.
351757
public ResultMatcher isNotNull() {
        return new AbstractResultMatcher(path, configuration) {
            public void doMatch(Object actual) {
                isNotNull(actual);
            }
        };
    }
1329810
@Nullable
    private static Object json(@Nullable Object in) {
        if (in == null) return null;
        return new Object() {
            @Override
            public String toString() {
                return "{\"fake-key\": \"fake-value\"}";
            }
        };
    }
449592
private JSONArray readOptionalArray(JSONObject json, String key) {

        try {
            return json.getJSONArray(key);
        } catch (JSONException e) {
            LOG.debug("Reading optional JSON array failed. Default to provided default value.", e);
        }
        return null;
    }
671457
private int readOptionalInt(JSONObject json, String key) {

        try {
            String str = json.getString(key);
            return Integer.valueOf(str).intValue();
        } catch (NumberFormatException | JSONException e) {
            LOG.debug("Reading optional JSON int failed. Default to provided default value.", e);
        }
        return 0;
    }
491969
function (jsonSource) {
		var json = null;

		try {
			json = JSON.parse(jsonSource);
		} catch (err) {
			json = jsonSource; // string
		}

		return json;
	}
706745
public static boolean isValidJsonValue( Object value ) {
      if( JSONNull.getInstance()
            .equals( value ) || value instanceof JSON || value instanceof Boolean
            || value instanceof Byte || value instanceof Short
            || value instanceof Integer || value instanceof Long || value instanceof Double
            || value instanceof BigInteger || value instanceof BigDecimal
            || value instanceof JSONFunction || value instanceof JSONString
            || value instanceof String ){
         return true;
      }
      return false;
   }
126574
function setJsonField(json, field, value) {
    if (value === undefined && typeof value === 'undefined') {
        //Ignore undefined values
        return;
    }
    if (value === null) {
        //Ignore null values
        return;
    }
    if (typeof value === 'boolean' && value === false) {
        //Ignore false values since they are generally default values.
        return;
    }
    json[field] = value;
}
206525
private static JsonArray getJsonValueAsArray(JsonValue value) {
        return (value != null && value.getValueType() == ValueType.ARRAY) ? value.asJsonArray() : null;
    }
224852
private static String getJsonFromRaw(Context context, int resource) {
        String json;
        try {
            InputStream inputStream = context.getResources().openRawResource(resource);
            int size = inputStream.available();
            byte[] buffer = new byte[size];
            inputStream.read(buffer);
            inputStream.close();
            json = new String(buffer, "UTF-8");
        } catch (IOException ex) {
            ex.printStackTrace();
            return null;
        }
        return json;
    }
79056
public void encodeNullToNull(Writer writer, T obj) throws IOException {
		if (obj == null) {
			writer.write("null");
			return;
		}

		JsonUtil.startHash(writer);

		encodeValue(writer, obj);

		JsonUtil.endHash(writer);

		writer.flush();
	}
637641
@SuppressWarnings("unchecked")
    public static <T> T json2GenericObject(String jsonString,
                                           TypeReference<T> tr) {

        if (jsonString == null || "".equals(jsonString)) {
            return null;
        } else {
            try {
                return (T) objectMapper.readValue(jsonString, tr);
            } catch (Exception e) {
                log.warn("json error:" + e.getMessage());
            }
        }
        return null;
    }
1252823
public function it_returns_valid_json_when_cast_to_string()
    {
        $this->__toString()->shouldBeString();
        $json = \json_decode((string) $this->getWrappedObject(), true);
//        $this->shouldBeBool(is_null($json));
//        $this->shouldEqual(JSON_ERROR_NONE, \json_last_error());
    }
928206
protected static boolean defaultIgnoreNullValue(Object obj) {
		if(obj instanceof CharSequence || obj instanceof JSONTokener || obj instanceof Map) {
			return false;
		}
		return true;
	}
214481
public static boolean mayBeJSON( String string ) {
      return string != null
            && ("null".equals( string )
                  || (string.startsWith( "[" ) && string.endsWith( "]" )) || (string.startsWith( "{" ) && string.endsWith( "}" )));
   }
402192
public function isValid($json=null) {
			if (empty($json) || ctype_space($json)) return false;
			json_decode($json);
			return (json_last_error() === JSON_ERROR_NONE);
		}
1005781
function(key){
                                if ($scope.json[key] !== null) $scope.jsonFn[key] = $scope.json[key].toString().trim();
                            }
191512
@Nullable
    public static Card fromString(@NonNull String jsonString) {
        try {
            JSONObject jsonObject = new JSONObject(jsonString);
            return fromJson(jsonObject);
        } catch (JSONException ignored) {
            return null;
        }
    }