对象转换成JSON的ArrayList要保存到SQLITE [英] Converting an ArrayList of Objects to JSON to be saved into SQLITE

查看:187
本文介绍了对象转换成JSON的ArrayList要保存到SQLITE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要对象(ArrayList的)的ArrayList存储到SQLite数据库。我已阅读,这是可以做到。我相信,通过ArrayList中转换成JSON,然后将该保存到一个字符串字段在SQLite表

I want to store an ArrayList of Objects (ArrayList) into a SQLITE database. I have read that this can be done. I believe that by converting the ArrayList to JSON and then save that to a String field in a SQLITE Table

有人能指出我在如何做到这一点的转换以及如何将其转换回之后ArrayList的方向是正确的。

Can someone point me in the right direction on how to do this conversion and how to convert it back to ArrayList afterwards.

感谢您的时间

推荐答案

这可以帮助你:

http://www.kodejava.org/examples/588.html

这个例子显示了如何转换的集合(list / ArrayList的) JSON 比你可以存储你的 JSON 字符串 sqlite的数据库。

This example shows how to convert Collection (List/ArrayList) to JSON than you can store your JSON string in Sqlite database.

这也显示出如何让的ArrayList JSON 字符串返回。

It is also showing how to get ArrayList back from JSON string.

这篇关于对象转换成JSON的ArrayList要保存到SQLITE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆