We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have the below model and i need to map the array of object directly to the model without creating two models
one for 'childActivityList' and the other for nested array object
can i take the values directly?
childId <- map["childActivityList.0.childId"]
The above will always take the first value
In other words...i need to get rid of childActivityList
"data": { "childActivityList": [ { "childId": "34bad8a5-0315-4d9f-a948-4780ed266040", "childName": "Test Produkte", "childImage": "https://testurl/s.png", "appName": "TikTok Lite", "appPackageName": "com.zhiliaoapp.musically.go", "appTime": "2167120", "openTime": "1619012403405", "deviceName": "Test Produkte_Android Tablet", "appIcon": null, "location": "Tirana", "isBlocked": false, "message": "now active on TikTok Lite" } }
class ActivityModel: Mappable, Encodable { var appName : String? var appPackageName : String? var appTime : String? var appIconURL:String? var deviceName : String? var id : String? var location : String? var openTime : String? var profileImage : String? var childName : String? var childImage : String? var message : String? required init?(map: Map) { } func mapping(map: Map) { appName <- map["appName"] appPackageName <- map["appPackageName"] appTime <- map["appTime"] deviceName <- map["deviceName"] id <- map["id"] location <- map["location"] openTime <- map["openTime"] profileImage <- map["profileImage"] appIconURL <- map["appIcon"] childName <- map["childName"] }
let activities = baseModel?.data?.childActivityList
I exepected something like:
Correct Model
nil values
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I have the below model and i need to map the array of object directly to the model without creating two models
one for 'childActivityList'
and the other for nested array object
can i take the values directly?
childId <- map["childActivityList.0.childId"]
The above will always take the first value
In other words...i need to get rid of childActivityList
Your JSON dictionary:
Your model:
What you did:
What you expected:
I exepected something like:
What you got:
nil values
The text was updated successfully, but these errors were encountered: