JAVA/자바
자바 JSON스트링 리스트로 변환
왕왕왕왕
2016. 12. 8. 15:13
@SuppressWarnings("unchecked")
public static List<Map<String, Object>> jsonArrStrToList(String jsonArrString) {
/** Local Value Object */
ObjectMapper mapper = null;
List<Map<String, Object>> bizList = null;
/** Business Logic */
//예외처리
if(isEmpty(jsonArrString)){
return null;
}
// Jackson Mapper 선언
mapper = new ObjectMapper();
//JSONArrayString을 List로 변환
try {
bizList = mapper.readValue(jsonArrString, List.class);
} catch (JsonParseException e) {
LOGGER.error(String.format(LogFormat.ERROR, e));
} catch (JsonMappingException e) {
LOGGER.error(String.format(LogFormat.ERROR, e));
} catch (IOException e) {
LOGGER.error(String.format(LogFormat.ERROR, e));
}
/** Return Logic*/
return bizList;
}