For an application i want to create a JSON in format as mentioned below,
\"Students\" : {
\"results\": {
\"Grade1\": {
\"studentresul
check this code-
NSMutableDictionary *students=[NSJSONSerialization JSONObjectWithData:webData options:0 error:nil];
for (NSDictionary *dictionofstudents in students)
{
NSMutableDictionary *results=[dictionofstudents objectForKey:@"results"];
for (NSDictionary *dictionofresults in results)
{
NSMutableDictionary *grade1=[dictionofresults objectForKey:@"Grade1"];
for (NSDictionary *dictionofgrade1 in grade1)
{
NSString *studentresult=[dictionofgrade1 objectForKey:@"studentresult"];
NSString *marksheet=[dictionofgrade1 objectForKey:@"marksheet"];
[arrayofstudentresult addObject:studentresult];
[arrayofmarksheet addObject:marksheet];
}
NSString *ID=[dictionofresults objectForKey:@"ID"];
NSString *name=[dictionofresults objectForKey:@"Name"];
[arrayofID addObject:ID];
[arrayofname addObject:name];
}
}