title: How do I JSON serialize an NSDate Dictionary in JSONKit
body: <p>I tried this using Jsonkit and Apple's JSON serializer with no luck.  It keeps breaking on the geo property, which is an nsarray of NSNumbers.</p>
  
  <pre><code>Post* p = [[Post alloc] init];
  
      p.uname = @"mike";
      p.likes =[NSNumber numberWithInt:1];
      p.geo = [[NSArray alloc] initWithObjects:[NSNumber numberWithFloat:37.78583], [NSNumber numberWithFloat:-122.406417], nil ];
      p.place = @"New York City";
      p.caption = @"A test caption";
      p.date = [NSDate date];
  
  
   NSError* error = nil;
  
      NSString* stuff = [[p getDictionary] JSONStringWithOptions:JKParseOptionNone error:&amp;error];
  </code></pre>
  
  <p>UPDATE: Checking on the error it's the NSDate that it fails on, not the NSArray.  How do I pass in the date formatter into the function?</p>
  
  <p>UPDATE 2: Solved- ok looked at the latest commit for jsonkit and saw that you could do this:</p>
  
  <pre><code> NSDateFormatter *outputFormatter = [[NSDateFormatter alloc] init];
      [outputFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSSZZZ"];
  
      NSString* result = [p.dictionary JSONStringWithOptions:JKSerializeOptionNone serializeUnsupportedClassesUsingBlock:^id(id object) {
          if([object isKindOfClass:[NSDate class]]) { return([outputFormatter stringFromDate:object]); }
          return(nil);
      } error:nil];
  </code></pre>
  
  <p>which seems to have worked but note that this feature for JSONKit is WIP so it could change in the next official release.</p>