很抱歉,如果这个问题得到了多次回答,但我正在查找自己的特定json问题,这就是为什么要发布此问题,这是我的json,它是通知的数组列表,在其他对象中,您可以看到它具有合同对象,现在此对象正在更改,它可以在json数组的第二个索引中进行运动或反馈,我如何为此制作Codable结构以解码这种jsonHere是我的结构,我无法在Codable中执行任何类型
struct Alert: Decodable {
var id: Int?
var isUnread: Bool?
var userId: Int?
var message: String?
var notificationType: String?
var extra: Any?
"value": [
{
"id": 153,"is_unread": true,"user_id": 3,"message": "Contract offered from JohnWick. Click here to see the details.","notification_type": "Contract","extra": {
"contract": {
"id": 477,"likes": 0,"shares": 0,"account_reach": 0.0,"followers": 0,"impressions": 0.0,"description": "Fsafasd","budget": 0.0,"start_date": null,"end_date": null,"status": "pending","is_accepted": false,"brand_id": 443,"influencer_id": 3,"proposal_id": 947,"created_at": "2019-11-09T17:40:57.646Z","updated_at": "2019-11-09T17:40:57.646Z","contract_fee": 435345.0,"base_fee": 5000.0,"transaction_fee": 43534.5,"total_fee": 483879.5,"infuencer_completed": false,"brand_completed": false,"comments": 0
}
}
},{
"id": 152,"message": "Message from JohnWick. Click here to check your inbox.","notification_type": "Message","extra": {
"message": {
"id": 495,"body": "Uuhvh","read": false,"conversation_id": 42,"created_at": "2019-11-08T13:44:02.055Z","updated_at": "2019-11-08T13:44:02.055Z"
}
}
},]
如您所见,它可以是消息,广告系列,合同或反馈,所以我该如何使用CodingKeys Codable对此进行解析或为此建立模型