I have some sort of data lets say Passengers and inside passenger I have children's array and infant's array, I am just bamboozled and just didn't get any clue to convert list of passengers to JSON
.
In objective-c so far I have seen that we convert class object to NSDictionary
by it toDictionary method.
My question is what if we have list of class object.. what's the catch here? how we gonna convert that list?
I have NSMutableArray
of passengers and inside a passenger object I have NSMutableArray
of children and infants.
How can I convert that list of passengers to Dictionary
for request?
I am new to objective-c, in java we used to serialise and deserialize.
I have already tried converting NSMutableArray
to NSDictionary
and so on but it seems like it doesn't work at all.
{
"airline_code":"AA",
"inbound_trip_id":122222,
"outbound_trip_id":111111,
"passengers":[
{
"address_line1":"fdsdsf",
"address_line2":"",
"children":[
{
"city":"abx",
"country":"abcd",
"country_access_code":"11",
"country_code":"AK",
"date_of_birth":"4#8#2017",
"email_address":"me@ok.com",
"first_name":"munna",
"gender":"Male",
"inbound_ssr_id":[
40420
],
"last_name":"khna",
"middle_name":"",
"nationality":"aaaa",
"outbound_ssr_id":[
40417
],
"passport_expiry_date":"4#29#2019",
"passport_issue_date":"4#8#2019",
"passport_number":"PPA2345",
"phone_number":"111111111",
"state":"aaa",
"title":"Mr",
"titleIndex":0,
"zip_code":"123213"
}
],
"city":"Dadu",
"country":"aa",
"country_access_code":"11",
"country_code":"aa",
"date_of_birth":"4#8#1973",
"email_address":"me@ok.com",
"firstAdult":0,
"first_name":"aaa",
"gender":"Male",
"inbound_ssr_id":[
40421
],
"billing_info":false,
"last_name":"ccc",
"middle_name":"",
"nationality":"PK",
"outbound_ssr_id":[
40416
],
"passport_expiry_date":"4#29#2019",
"passport_issue_date":"4#8#2019",
"passport_number":"PPA12345",
"phone_number":"111111111",
"state":"OOA",
"title":"Mr",
"zip_code":"324546"
},
{
"address_line1":"dfdsfdsf",
"address_line2":"",
"city":"Beletwene",
"country":"Somalia",
"country_access_code":"252",
"country_code":"SO",
"date_of_birth":"4#8#1989",
"email_address":"me@me.com",
"firstAdult":0,
"first_name":"vv",
"gender":"Male",
"genederIndex":0,
"inbound_ssr_id":[
40419
],
"billing_info":false,
"last_name":"fdf",
"middle_name":"",
"nationality":"PP",
"outbound_ssr_id":[
40418
],
"passport_expiry_date":"4#29#2019",
"passport_issue_date":"4#8#2019",
"passport_number":"PPA123435",
"phone_number":"615100002",
"state":"PPA",
"title":"Mr",
"titleIndex":0,
"zip_code":"23454"
}
],
"search_id":"0000000000000000000000000000000000000",
"token_id":"0000000000000000000000000000000000000"
}