Q:

How assign value to a JSON string?

I get this JSON object from my web service
0:  {
Username: "John"
Password: "12345"
Position: "Admin"
Job: "Developer"
ResourceJobId: 1
}

When I try to assign a value, for example, to Username JSON string, I get a semantic error:
id obj = [NSJSONSerialization JSONObjectWithData:data
                                                 options:NSJSONReadingAllowFragments
                                                   error:&error];
            for (NSDictionary *dictionary in array) {
                NSString *usernameString = @"";
//this line of code gives me an error: Expression is not assignable               
[dictionary objectForKey:@"Username"] = usernameString   ;

I know how get the JSON object with NSJSONSerialization class, but my target is how assign the value @"" to the JSON object.
So how can I assign the value @"" to the Username JSON string?

A:

While you are trying to fetched dictionary from array. it is not mutable dictionary so you need to created NSMutableDictionary while fetching data from Array. following code will help you to change username.
for (NSMutableDictionary *dictionary in array)
{
   NSMutableDictionary* dictTemp = [NSMutableDictionary dictionaryWithDictionary:dictionary];

   [dictTemp setObject:usernameString forKey@"Username"];

   [_arrayList replaceObjectAtIndex:index withObject:dictTemp];
}

