1

I have a webserver which accepts dates in dd/MM/yyyy format. I construct the string representation of NSDate like this :

NSDateFormatter *dateFormatter = [NSDateFormatter new];
dateFormatter.dateFormat = @"dd/MM/yyy";
NSString *dateString = [dateFormatter stringFromDate:[NSDate new]];

The string is fine. However, after the whole server input gets processd through [NSJSONSerialization dataWithJSONObject: options: error:] the / gets escaped and the result looks like this : 10\/01\/2015

I do realize that the easiest way is to allow the server to accept other date delimiter (i.e. - or .) but I'm interested whether there is a way to make NSJSONSerialization NOT escape characters.

Losiowaty
  • 7,911
  • 2
  • 32
  • 47
  • You can't fix your server to use a JSON decoder that implements the standard? – rob mayoff Jan 26 '16 at 21:22
  • As I said - I know this would be the easiest way to do this. I just couldn't think of a way to "fix" this on my side, and was curious "academically" of the possibilities :) – Losiowaty Jan 26 '16 at 21:24
  • 1
    The way to do it is to make it not meet the specifications for JSON serialization. – Hot Licks Jan 26 '16 at 21:53

0 Answers0