JSON转对象

it2024-01-19  59

@Test public void test10() { final String resStr = "{\"username\":\"Tom\",\"password\":\"123456\"}"; final JSONObject jsonObject = JSONObject.parseObject(resStr); final User user = JSON.toJavaObject(jsonObject, User.class); System.out.println(JSONObject.toJSONString(user)); }
最新回复(0)