首页 > Web开发 > 详细

JSON类型的String转成List<String>

时间:2019-04-12 16:22:51      阅读:1675      评论:0      收藏:0      [点我收藏+]
//后端调用接口 
List<String> directives = new ArrayList<>();
while (matcher.find()) {
directives.add(matcher.group(1));
LOGGER.info("处理标签:{}", matcher.group(1));
}
JSONObject jsonObject = new JSONObject();

Map map2=new HashMap();
//将List<String> 转为JSON存储 放入map中
map2.put("marksList",JSON.toJSONString(directives));
map2.put("userId","SU000000000195");
JSONObject obj2 = PostInterface.post(PostInterface.ServletName.placeholder,"queryPlaceHolderByMarks",map2).getJSONObject("SvcCont");
List<Placeholder> pList = JSON.parseArray(obj2.getString("placeHolderList"),Placeholder.class);

 

//接口中解析

JSON中string转List<String>
List<String> pList = JSON.parseArray(svcCont4PlaceHolderReq.getMarksList(),String.class);

JSON类型的String转成List<String>

原文:https://www.cnblogs.com/320321ABab/p/10688659.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!