import com.fasterxml.jackson.databind.ObjectMapper;

 

String response = null;
 response = HttpsUtil.connectionHttpsPostJsonDataAndReturnStringWx(URL, data); // httpPost 方法

ObjectMapper mapper = new ObjectMapper();
WxRs wxRs = mapper.readValue(responseT, WxRs.class);

 

mapper.readValue  通常會被包成:

public static <T>T jsonToBean(String json, Class<T> clazz) throws IOException {
        return (T)objectMapper.readValue(json, clazz);
    }

 

 

文章標籤
全站熱搜
創作者介紹
創作者 JoshS 的頭像
JoshS

JoshS的部落格

JoshS 發表在 痞客邦 留言(0) 人氣(12)