320321ABab

JSON类型的String转成List<String>

//后端调用接口 
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);

分类:

技术点:

相关文章:

  • 2021-10-04
  • 2022-03-02
  • 2021-12-24
  • 2021-06-26
  • 2021-08-18
  • 2021-11-04
  • 2021-09-21
  • 2021-10-05
猜你喜欢
  • 2021-11-24
  • 2022-01-25
  • 2018-04-02
  • 2021-09-13
  • 2021-12-31
  • 2022-01-15
相关资源
相似解决方案