yw-ah

谷歌的Gson.jar:

//list转换为json
Gson gson = new Gson();  
List<Person> persons = new ArrayList<Person>();  
String str = gson.toJson(persons);  
//json转换为list
Gson gson = new Gson();  
List<Person> persons = gson.fromJson(str, new TypeToken<List<Person>>(){}.getType());  

 

阿里的fastJson.jar:

//list转换为json
List<CustPhone> list = new ArrayList<CustPhone>();
String str=JSON.toJSON(list).toString();
//json转换为list
  List<Person> list = new ArrayList<Person>();  
        list = JSONObject.parseArray(jasonArray, Person.class); 

分类:

技术点:

相关文章:

  • 2021-11-24
  • 2021-12-23
  • 2021-12-31
  • 2021-07-13
  • 2021-08-06
  • 2021-11-18
  • 2021-08-12
猜你喜欢
  • 2021-11-14
  • 2021-11-29
  • 2021-09-14
  • 2022-01-02
  • 2021-12-08
相关资源
相似解决方案