close
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);
}
全站熱搜