@Test public void test_getObj() throws Exception { String str = "{\"username\":\"testuser\",\"password\":\"testuser\"}"; UserLogin userLogin = new UserLogin("testuser", "testuser"); Object ob = JSONUtil.getObj(str, UserLogin.class); assertTrue(UserLogin.class.equals(((UserLogin)ob).getClass())); }
public static Object getObj(String jsonStr, Class<?> className) throws JsonParseException, JsonMappingException, IOException { ObjectMapper mapper = new ObjectMapper(); return mapper.readValue(jsonStr, className); }
JSONUtil { public static Object getObj(String jsonStr, Class<?> className) throws JsonParseException, JsonMappingException, IOException { ObjectMapper mapper = new ObjectMapper(); return mapper.readValue(jsonStr, className); } }
JSONUtil { public static Object getObj(String jsonStr, Class<?> className) throws JsonParseException, JsonMappingException, IOException { ObjectMapper mapper = new ObjectMapper(); return mapper.readValue(jsonStr, className); }  }
JSONUtil { public static Object getObj(String jsonStr, Class<?> className) throws JsonParseException, JsonMappingException, IOException { ObjectMapper mapper = new ObjectMapper(); return mapper.readValue(jsonStr, className); }  static String getJSON(Object obj); static String getJSONasDefaultPrettyPrint(Object obj); static String getJSONasDefaultPrettyPrintFromString(String obj); static Object getObj(String jsonStr, Class<?> className); }
JSONUtil { public static Object getObj(String jsonStr, Class<?> className) throws JsonParseException, JsonMappingException, IOException { ObjectMapper mapper = new ObjectMapper(); return mapper.readValue(jsonStr, className); }  static String getJSON(Object obj); static String getJSONasDefaultPrettyPrint(Object obj); static String getJSONasDefaultPrettyPrintFromString(String obj); static Object getObj(String jsonStr, Class<?> className);  }