【发布时间】:2021-06-26 06:09:41
【问题描述】:
我是 Room 数据库的新手,我有来自 MSGraph API 的 JSON 响应,即日历事件列表。
我想将此响应存储在 Room 数据库中。
改造的示例响应 数据
{
"@odata.context":"",
"value":[
{
"@odata.etag":"W/\"arcvR4W/==\"",
"id":"AAvR4W-QUGEzDhwKmVNegAAFPBq3AAAEA==",
"createdDateTime":"2020-05-28T11:15:19.3397025Z",
"lastModifiedDateTime":"2020-09-08T15:57:16.2356808Z",
"changeKey":"arcvR4W/==",
"categories":[
],
"transactionId":null,
"originalStartTimeZone":"UTC",
"originalEndTimeZone":"UTC",
"iCalUId":"040000008200E00074C5B7101A82E831",
"reminderMinutesBeforeStart":15,
"isReminderOn":true,
"hasAttachments":false,
"subject":"Canceled: discussion",
"bodyPreview":"time didnt set correctly, so cancelling the call",
"importance":"high",
"sensitivity":"normal",
"isAllDay":true,
"isCancelled":true,
"isOrganizer":false,
"responseRequested":true,
"seriesMasterId":"AAMkADU3MAAAAENAABqty9Hhb9BQYTMOHAqZU16AAAU8GrcAAA=",
"showAs":"free",
"type":"occurrence",
"webLink":"https://outlook.office365.com/",
"onlineMeetingUrl":null,
"isOnlineMeeting":true,
"onlineMeetingProvider":"teams",
"allowNewTimeProposals":true,
"isDraft":false,
"hideAttendees":false,
"responseStatus":{
"response":"accepted",
"time":"2020-05-28T11:15:00Z"
},
"body":{
"contentType":"html",
"content":"<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n<meta content=\"text/html; charset=us-ascii\">\r\n</head>\r\n<body>\r\n<div>time didnt set correctly, so cancelling the call</div>\r\n</body>\r\n</html>\r\n"
},
"start":{
"dateTime":"2021-03-11T00:00:00.0000000",
"timeZone":"UTC"
},
"end":{
"dateTime":"2021-03-12T00:00:00.0000000",
"timeZone":"UTC"
},
"location":{
"displayName":"",
"locationType":"default",
"uniqueIdType":"unknown",
"address":{
},
"coordinates":{
}
},
"locations":[
],
"recurrence":null,
"attendees":[
{
"type":"required",
"status":{
"response":"none",
"time":"0001-01-01T00:00:00Z"
},
"emailAddress":{
"name":"abc",
"address":"abc@mail.com"
}
},
{
"type":"required",
"status":{
"response":"none",
"time":"0001-01-01T00:00:00Z"
},
"emailAddress":{
"name":"xyz",
"address":"xyz@mail.com"
}
}
],
"organizer":{
"emailAddress":{
"name":"abc",
"address":"abc@mail.com"
}
},
"onlineMeeting":{
"joinUrl":""
}
},
more elements from list
]
}
我搜索了论坛,但没有得到任何正确的解决方案。 我想将此响应存储在 Room 数据库中。有人可以帮助我遵循正确的方法。
谢谢
【问题讨论】:
标签: android json android-room