Android 如何将此JSON放入sql文件室

Android 如何将此JSON放入sql文件室,android,sqlite,kotlin,android-room,Android,Sqlite,Kotlin,Android Room,大家好,帮我解决房间的问题,在这一周里我无法从子类加载数据,当我通过改造获得数据时没有问题,但我找不到将数据写入comet的解决方案。使用@Relation、@Embedded和all都没有成功。我将非常感谢任何帮助。Izvestenie表示,如果写得不清楚,谷歌会使用翻译器 "code": 200, "sucsses": true, "data": { "booking_info": [ { "_id": "5af2d48bc09d261ba4e20bf0"

大家好,帮我解决房间的问题,在这一周里我无法从子类加载数据,当我通过改造获得数据时没有问题,但我找不到将数据写入comet的解决方案。使用@Relation、@Embedded和all都没有成功。我将非常感谢任何帮助。Izvestenie表示,如果写得不清楚,谷歌会使用翻译器

  "code": 200,
  "sucsses": true,
  "data": {
    "booking_info": [
    {
    "_id": "5af2d48bc09d261ba4e20bf0",
      "imageBooking": [

    ],
    "nameBooking": "nameBooking",
    "descriptionBooking": "descriptionbooking fqwfqwfqwf qwfqwfqwfqwfqwf",
    "taskBooking": "Привезти песок",
    "priceBooking": null,
    "rateBooking": null,
    "coordinateBooking": {
      "latitudeBooking": 234345444,
      "longitudeBooking": 325253525
    },
    "clockWork": null,
    "user_id": "5ae5ec8da8f2a90b04b1f715"
  },
  {
    "_id": "5af45fa836ee831b540849f1",
    "imageBooking": [

    ],
    "nameBooking": "nameBooking",
    "descriptionBooking": "descriptionbooking fqwfqwfqwf qwfqwfqwfqwfqwf",
    "taskBooking": "Привезти песок",
    "priceBooking": null,
    "rateBooking": null,
    "coordinateBooking": {
      "latitudeBooking": 234345444,
      "longitudeBooking": 325253525
    },
    "clockWork": null,
    "user_id": "5ae5ec8da8f2a90b04b1f715"
  },
数据类

@Entity(tableName = "booking")
data class BookingModel(
    @PrimaryKey(autoGenerate = true)
    var id: Int = 0,
    var code: Int = 0,
    var sucsses: Boolean = true,
    @Ignore
    var data: BookingModel?,
   @TypeConverters(GithubTypeConverters::class)
    var booking_info: List<BookingModel>?

) {
    constructor() : this(0, 0, true, null, null)
}




 @TypeConverter
fun fromCountryLangList(countryLang: List<BookingModel>?): String? {
    if (countryLang == null) {
        return null
    }
    val gson = Gson()
    val type = object : TypeToken<List<BookingModel>>() {

    }.type
    return gson.toJson(countryLang, type)
}

@TypeConverter
fun toCountryLangList(countryLangString: String?): List<BookingModel>? {
    if (countryLangString == null) {
        return null
    }
    val gson = Gson()
    val type = object : TypeToken<List<BookingModel>>() {

    }.type
    return gson.fromJson<List<BookingModel>>(countryLangString, type)
}



 @Database(
            entities = [
            BookingModel::class],
            version = 1,
           exportSchema = false
 )
 @TypeConverters(GithubTypeConverters::class)
 abstract class HelpCarDataBase : RoomDatabase() {
  abstract fun daoService(): DaoService
}
@实体(tableName=“预订”)
数据类预订模型(
@PrimaryKey(自动生成=真)
变量id:Int=0,
变量代码:Int=0,
变量成功:布尔值=真,
@忽略
var数据:记账模型?,
@类型转换器(GithubTypeConverters::class)
var预订信息:列表?
) {
构造函数():这(0,0,true,null,null)
}
@类型转换器
CountryLangList的乐趣(countryLang:List?):字符串?{
if(countryLang==null){
返回空
}
val gson=gson()
val type=object:TypeToken(){
}.类型
返回gson.toJson(countryLang,type)
}
@类型转换器
乡村英语爱好者的乐趣(countryLangString:String?):列表?{
如果(countryLangString==null){
返回空
}
val gson=gson()
val type=object:TypeToken(){
}.类型
返回gson.fromJson(countryLangString,类型)
}
@数据库(
实体=[
BookingModel::class],
版本=1,
exportSchema=false
)
@类型转换器(GithubTypeConverters::class)
抽象类HelpCardDatabase:RoomDatabase(){
抽象服务():daoService
}

您什么时候建立房间数据库?能否共享日志和房间构建块?在日志中找不到任何内容,只有一张空表预订信息