I have data from JSON response that I am transferring to an array as shown below
originalPerson.firstname = [memberData valueForKey:@"firstname"];
originalPerson.lastname = [memberData valueForKey:@"lastname"];
originalPerson.address1 = [memberData valueForKey:@"address1"];
Is there a way to handle this in a loop rather than typing each line out? TIA
If the class of the instance originalPerson is key-value coding (KVC) compliant, you could use something like
or even
if member data is a dictionary and you’re sure (or check that) originalPerson has the corresponding properties. I don’t know how you are parsing your JSON but I recomend SBJSON for objective C.