android - 在房间数据库 Android (Kotlin) 中映射复杂的 JSON
问题描述
我有一个复杂的 JSON,我需要解析 JSON 数据中的信息并将其存储到 Room 数据库中。是否可以将整个 JSON 存储在 Room 中?如果可能的话,我也愿意。我正在使用科特林。任何人都可以指导我吗?这是我的 JSON 示例:
{
"chapters": [
{
"play": "manual",
"items": [
{
"image": "/path/to/image",
"background": "#ffffff",
"text": "text to show on image",
"points": 1,
"voice": {
"type": "tts"
},
"words": {
"type": "wav",
"file": "/path to words file",
"parts": [
{
"word": "text",
"from": 122,
"to": 116
}
]
}
},
{
"image": "/path/to/image",
"background": "#ffffff",
"text": "text to show on image",
"points": 1,
"voice": {
"type": "wav",
"file": "/path/to/file"
}
}
]
}
]
}