title: creating JSON format in Objective C
body: <p>For an application i want to create a JSON in format as mentioned below,</p>
  
  <pre><code>"Students" : {
      "results": {
          "Grade1": {
              "studentresult": "pass",
              "marksheet": "provided"
          },
          "ID": 01,
          "Name": "Student1", 
      }
  }
  </code></pre>
  
  <p>I am using the following code to create the same,</p>
  
  <pre><code>NSMutableDictionary *gradedetails = [[NSMutableDictionary alloc] init];
  [gradedetails setObject:@"pass" forKey:@"studentresult"];
  [gradedetails setObject:@"provided" forKey:@"marksheet"];
  
  NSMutableDictionary *sdetails = [[NSMutableDictionary alloc] init];
  [sdetails setObject:@"01" forKey:@"ID"];
  [sdetails setObject:@"Name" forKey:@"Student1"];
  
  NSMutableDictionary *grade = [[NSMutableDictionary alloc] init];
  [grade setObject:gradedetails forKey:@"Grade1"];
  
  NSMutableArray *rarray = [[NSMutableArray alloc] init];
  [rarray addObject:grade];
  [rarray addObject:sdetails];
  
  NSMutableDictionary *results = [[NSMutableDictionary alloc] init];
  [results setObject:rarray forKey:@"results"];
  
  NSMutableDictionary *stud = [[NSMutableDictionary alloc] init];
  [stud setObject:rdic forKey:@"Students"];
  
  NSData *jsondata = [NSJSONSerialization dataWithJSONObject:stud options:NSJSONWritingPrettyPrinted error:&amp;error];
  </code></pre>
  
  <p>I am getting in the following format, </p>
  
  <pre><code>"Students" : {
  "results" : [
    {
      "Grade1" : {
        "studentresult" : "pass",
        "marksheet" : "provided" 
      }
    },
    {
      "ID" : "01",
      "Name" : "Student1"
    }
  ]
  </code></pre>
  
  <p>}
  }</p>
  
  <p>could someone please help me in creating the format.</p>
  
  <p>Thanks.</p>