Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added special handlers so that we don't break when serializing dates …

…and objects that respond to stringValue.
  • Loading branch information...
commit 50bdd6164847b552e3d3e0420cd8940bda992f2c 1 parent 3912d8e
@timburks authored
Showing with 10 additions and 0 deletions.
  1. +10 −0 objc/JSON.m
View
10 objc/JSON.m
@@ -180,6 +180,16 @@ - (BOOL)appendValue:(id)fragment into:(NSMutableString*)json error:(NSError**)er
[json appendString:@"null"];
}
+ else if ([fragment isKindOfClass:[NSDate class]]) {
+ [json appendString:@"\""];
+ [json appendString:[fragment description]];
+ [json appendString:@"\""];
+ }
+ else if ([fragment respondsToSelector:@selector(stringValue)]) {
+ [json appendString:@"\""];
+ [json appendString:[fragment stringValue]];
+ [json appendString:@"\""];
+ }
else {
*error = err(EUNSUPPORTED, [NSString stringWithFormat:@"JSON serialisation not supported for %@", [fragment class]]);
return NO;
Please sign in to comment.
Something went wrong with that request. Please try again.