如何在sqlite中存储json数据 [英] How to store json data in sqlite

查看:2072
本文介绍了如何在sqlite中存储json数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难将数据以JSON格式存储到我的sqlite数据库中以用于Rails应用程序.我已经搜索了如何在sqlite数据库中将数据作为JSON存储,但是没有看到很多有希望的替代方法.谁能指导我如何做到这一点?

Im hard pressed to store data as 'JSON' format into my sqlite database for an rails application. I have searched for how to store data as JSON in my sqlite database but am not seeing many alternatives which are promising. Any one who can guide me on how this can be done?

推荐答案

首先尝试使用"JSON"作为数据类型,但是由于SQLite不支持"JSON"数据类型,因此它失败了.然后我再次使用设置为字符串"类型的属性的数据类型执行了迁移,然后它开始工作.

Tried first using 'JSON' as an data type but since SQLite had no support for 'JSON' data type it failed. Then again I performed an migration with the data type for the attribute set up as type 'string' and it started to work.

这篇关于如何在sqlite中存储json数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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