I want to create a JSON array of the following structure:
"Create Account":{
"RegistryNumber":"",
"People":[{
"PeopleId":"",
"email":"",
"pass":"",
}]
}
I am using the folllowing code to do it:
NSDictionary *content0 = [NSDictionary dictionaryWithObjectsAndKeys:
@"PeopleId", @"0",
@"email", @"email",
@"pass", @"pass",nil];
NSArray *peopledetails = [NSArray arrayWithObjects:content0,nil];
NSMutableDictionary *peopleDict = [[NSMutableDictionary alloc] init];
[peopleDict setObject:@"content0" forKey:@"People"];
NSMutableDictionary *details = [[NSMutableDictionary alloc] init];
[details setObject:@"RegistryNumber" forKey:@"RegistryNumber"];
[details setObject:@"peopleDict" forKey:@"People"];
NSMutableDictionary *MainDict = [[NSMutableDictionary alloc] init];
[MainDict setObject:@"details" forKey:@"Create Account"];
But this gives me an error from the server. I have other API which works fine when array is not in picture.