getAll的实现方法

 Criteria criteria = session.createCriteria(StockPool.class);
        return criteria.list();

 

list转json

   List<Openid> openids = od.getAll(session);
        String json = JSONObject.toJSONString(openids);

 

 
JSONObject articleLocal = JSONObject.parseObject(testString);//先把字符串转换为json对象
ArticleModel art = JSONObject.toJavaObject(articleLocal, ArticleModel.class);//再把json对象转为java对象
     

json转list

 List<UserModel> users = InitdataBean.userModels;//获取一个对象列表
        String userjson = JSONObject.toJSONString(users);//列表转json字符串
        List<UserModel> userList = JSONObject.parseArray(userjson, UserModel.class);//字符串转对象列表

一个list

[
{"openid":"kjhfdsadf"},
{"openid":"的风口浪尖"}
]

相关文章:

  • 2021-07-15
  • 2022-01-02
  • 2022-12-23
  • 2021-08-07
  • 2022-12-23
猜你喜欢
  • 2021-07-01
  • 2022-12-23
  • 2022-12-23
  • 2021-08-18
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案