title: How to convert NSArray of NSStrings into Json String iOS
body: <p>I have an Array of Roll Numbers </p>
  
  <pre><code>NSArray *rollArray = [NSArray arrayWithObjects:@"1", @"22", @"24", @"11", nil];
  </code></pre>
  
  <p>I need to send this array in a Web Service request</p>
  
  <p>whose format is like this (in JSON format)</p>
  
  <p>JSON data</p>
  
  <pre><code>{
    "existingRoll":["22","34","45","56"], // Array of roll numbers
    "deletedRoll":["20","34","44","56"] // Array of roll numbers
  }
  </code></pre>
  
  <p>but I am facing problem in converting Array of Roll numbers (rollArray) into json String 
  in the desired format.</p>
  
  <p>I am trying this</p>
  
  <pre><code> NSMutableDictionary *postDict = [[NSMutableDictionary alloc]init];
    [postDict setValue:[rollArray componentsJoinedByString:@","] forKey:@"existingRoll"];
  
   NSString *str = [Self convertToJSONString:postDict]; // converts to json string
  
   NSData *jsonData = [NSJSONSerialization dataWithJSONObject:str options:0 error:nil];
  
   [request setHTTPBody:jsonData];
  </code></pre>
  
  <p>I am using iOS 7</p>