@Test public void isJson() { assertThat(JsonUtils.isJson(null)).isFalse(); assertThat(JsonUtils.isJson("")).isFalse(); assertThat(JsonUtils.isJson("{}")).isTrue(); assertThat(JsonUtils.isJson("{\"foo\": \"bar\"}")).isTrue(); assertThat(JsonUtils.isJson(" {\"foo\": \"bar\"} ")).isTrue(); assertThat(JsonUtils.isJson("\n{\"foo\": \"bar\"}\n")).isTrue(); assertThat(JsonUtils.isJson("[]")).isTrue(); assertThat(JsonUtils.isJson("[{\"foo\": \"bar\"}]")).isTrue(); assertThat(JsonUtils.isJson(" [{\"foo\": \"bar\"}] ")).isTrue(); assertThat(JsonUtils.isJson("\n[{\"foo\": \"bar\"}]\n")).isTrue(); }
public static boolean isJson(String value) { if (value == null) { return false; } return isJsonObject(value) || isJsonArray(value); }
JsonUtils { public static boolean isJson(String value) { if (value == null) { return false; } return isJsonObject(value) || isJsonArray(value); } }
JsonUtils { public static boolean isJson(String value) { if (value == null) { return false; } return isJsonObject(value) || isJsonArray(value); } private  JsonUtils(); }
JsonUtils { public static boolean isJson(String value) { if (value == null) { return false; } return isJsonObject(value) || isJsonArray(value); } private  JsonUtils(); static ObjectReader reader(); static T readFromStream(final InputStream stream, final Class<T> type); static ObjectWriter writer(); static ObjectMapper copyObjectMapperConfiguration(); static Map<String, Object> map(Object... values); static T convertValue(final Object fromValue, final Class<T> toValueType); static boolean isJson(String value); static boolean isJsonObject(String value); static boolean isJsonArray(String value); static List<String> arrayToJsonBeans(JsonNode json); static String jsonBeansToArray(List<?> jsonBeans); static String toPrettyString(Object value); static String toString(Object value); }
JsonUtils { public static boolean isJson(String value) { if (value == null) { return false; } return isJsonObject(value) || isJsonArray(value); } private  JsonUtils(); static ObjectReader reader(); static T readFromStream(final InputStream stream, final Class<T> type); static ObjectWriter writer(); static ObjectMapper copyObjectMapperConfiguration(); static Map<String, Object> map(Object... values); static T convertValue(final Object fromValue, final Class<T> toValueType); static boolean isJson(String value); static boolean isJsonObject(String value); static boolean isJsonArray(String value); static List<String> arrayToJsonBeans(JsonNode json); static String jsonBeansToArray(List<?> jsonBeans); static String toPrettyString(Object value); static String toString(Object value);  }