废话少说,直接贴刚新鲜完成的源码;
框架是Java+springboot+mybatisplus+testng+jenkins+git
@SpringBootTest public class MoreListTest extends AbstractTestNGSpringContextTests { @Autowired private RestTemplate restTemplate; @Autowired private UrlConfig urlConfig; @Test public void more() { String jsonString = "{\"a2w9_notice_title\":\"\",\"a2w9_release_start_time\":\"\",\"a2w9_release_end_time\":\"\",\"current\":1,\"pageSize\":7,\"a2w9_notice_type\":2}"; Map<String, Object> requestMap = new HashMap<>(); try { // 使用Jackson库解析JSON字符串为Map ObjectMapper objectMapper = new ObjectMapper(); Map<String, Object> jsonMap = objectMapper.readValue(jsonString, new TypeReference<Map<String, Object>>() { }); // 将解析得到的Map添加到requestMap中 requestMap.putAll(jsonMap); } catch (Exception e) { e.printStackTrace(); // 处理异常 }