title: Pass NSDate in NSDictionary and convert into NSData for jsondata fix
body: <p>I have a json having <code>NSString</code> and <code>NSDate</code> data (dob)
  I create an <code>NSDictionary</code> of it, but when I am converting it into data using code</p>
  
  <pre><code> NSData *requestData1 = [NSJSONSerialization dataWithJSONObject:json_inputDic options:0 error:&amp;error];
  </code></pre>
  
  <p>It kills by giving error</p>
  
  <pre><code>Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid type in JSON write (__NSDate)'
  </code></pre>
  
  <p>My problem is that i need to pass dob as NSDate is mandatory. How do I fix it?</p>
  
  <p>For example</p>
  
  <pre><code>   NSDate *newDate = [NSDate date];
      [dic setValue:newDate forKey:@"dob"];
  
  
      NSString *good = @"good";
  
      [dic setValue:good forKey:@"good"];
  
      NSLog(@"dic=%@",dic);
      NSError *error;
      NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dic options:NSJSONWritingPrettyPrinted error:&amp;error]; //it gives error
  
      NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
      NSLog(@"jsonData as string:\n%@", jsonString);
  </code></pre>