一卷旌收千骑虏,万全身出百重围。这篇文章主要讲述com.fasterxml.jackson.databind.ObjectMapper..readValue.convertValue相关的知识,希望能为你提供帮助。
String str="{"student":[{"name":"leilei","age":23},{"name":"leilei02","age":23}]}"; Student stu = null; List< Student> list = null; try { ObjectMapper objectMapper=new ObjectMapper(); StudentList studentList=objectMapper.readValue(str, StudentList.class); list=studentList.getStudent(); } catch (Exception e) { e.printStackTrace(); } list.streams.forEach(System::out::println)
ArrayList< Student> list=new ArrayList< Student> (); Student s1=new Student(); s1.setName("leilei01"); s1.setAge(23); Student s2=new Student(); s2.setName("leilei02"); s2.setAge(23); list.add(s1); list.add(s2); StringWriter str=new StringWriter(); ObjectMapper objectMapper=new ObjectMapper(); try { objectMapper.writeValue(str, list); } catch (Exception e) { e.printStackTrace(); } System.out.println(str);
【com.fasterxml.jackson.databind.ObjectMapper..readValue.convertValue】
推荐阅读
- android 属性介绍
- 手机APP测试环境搭建---appium
- Shareinstall一一可以解决APP大大小小的问题
- App.config自定义节点读取
- Android 实现锚点定位
- appium原理及api
- Android 初始化语言 --init.rc
- Android源码分析ServiceManager服务分析
- android环境的搭配