Remove " " from key string in a NSMutableDictionary

52 views Asked by At

Here's my dictionary:

Birthdate = "01-01-0001";
CareerField = 3;
Gender = 2;
"Interests[0].UserProfileId" = 19594;
"Interests[0].UserSurveyId" = 1;
SocialStatus = 2;
Studies = 3;

But I want the Interests key to be without "".Like that:

Birthdate = "01-01-0001";
CareerField = 3;
Gender = 2;
Interests[0].UserProfileId = 19594;
Interests[0].UserSurveyId = 1;
SocialStatus = 2;
Studies = 3;

UPDATE: Interests i must send them like array.

[dict setObject:self.birthdayDate forKey:@"Birthdate"]
[dict setObject:@(self.occupationPickerRow + 1) forKey:@"CareerField"];

for (int i = 0; i < [interestsArray count]; i++) {
    NSString *stringSurveyId = [NSString stringWithFormat:@"%@%d%@", @"Interests[", indexCount, @"].UserSurveyId"];
    NSString *stringUserProfileId = [NSString stringWithFormat:@"%@%d%@", @"Interests[", indexCount, @"].UserProfileId"];

    [dict setObject:[interestsArray objectAtIndex:i] forKey:stringSurveyId];
    [dict setObject:@([[[MZEngine sharedInstance] currentUserModel] userId]) forKey:stringUserProfileId];
    indexCount++;
}
0

There are 0 answers