SteemJUtils { public static boolean verifyJsonString(String customJsonString) { boolean valid = true; try { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.readTree(customJsonString); } catch (IOException e) { LOGGER.debug("The given json is invalid.", e); valid = false; } return valid; } private  SteemJUtils(); static boolean verifyJsonString(String customJsonString); static byte[] transformShortToByteArray(int shortValue); static byte[] transformLongToByteArray(long longValue); static byte transformByteToLittleEndian(byte byteValue); static byte[] transformStringToVarIntByteArray(String string); static byte[] transformIntToVarIntByteArray(int intValue); static byte[] transformShortToByteArray(short shortValue); static byte[] transformIntToByteArray(int intValue); static byte[] transformBooleanToByteArray(boolean boolValue); static byte[] transformLongToVarIntByteArray(long longValue); static String transformDateToString(Date date); static long transformStringToTimestamp(String dateTime); static String privateKeyToWIF(ECKey privateKey); static T setIfNotNull(T objectToSet, String message); static T setIfNotNull(T objectToSet, String message, @Nullable T defaultValue); static T setIfNotNull(T objectToSet, @Nullable T defaultValue); static List<T> setIfNotNullAndNotEmpty(List<T> collectionToSet, String message);  }
@Test public void testVerifyJsonString() { assertTrue(SteemJUtils.verifyJsonString("{\"menu\": {\"id\": \"file\", \"value\": \"File\", \"popup\": " + "{ \"menuitem\": [ {\"value\": \"New\", \"onclick\": \"CreateNewDoc()\"}, " + "{\"value\": \"Open\", \"onclick\": \"OpenDoc()\"}," + "{\"value\": \"Close\", \"onclick\": \"CloseDoc()\"}]}}}")); assertFalse(SteemJUtils.verifyJsonString("{\"menu\": {\"id\": \"file\", \"value\": \"File\", \"popup\": " + "{ \"menuitem\": [ {\"value\": \"New\", \"onclick\": \"CreateNewDoc()\"}, " + "{\"value\": \"Open\", \"onclick\": \"OpenDoc()\"}," + "{\"value\": [\"Close\",] \"onclick\": \"CloseDoc()\"}]}}")); }