File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -453,7 +453,7 @@ Examples
453453
454454#### Using the built-in thin HTTP client
455455
456- ```ruby
456+ ```objective-c
457457
458458//add extra headers
459459[[JSONHTTPClient requestHeaders] setValue:@"MySecret" forKey:@"AuthorizationToken"];
@@ -470,7 +470,7 @@ Examples
470470
471471#### Export model to NSDictionary or to JSON text
472472
473- ``` ruby
473+ ``` objective-c
474474
475475ProductModel* pm = [[ProductModel alloc ] initWithString: jsonString error: nil ] ;
476476pm.name = @"Changed Name";
@@ -483,8 +483,29 @@ NSString* string = [pm toJSONString];
483483
484484```
485485
486+ #### Custom data transformers
487+
488+ ```objective-c
489+
490+ @implementation JSONValueTransformer (CustomTransformer)
491+
492+ - (NSDate *)NSDateFromNSString:(NSString*)string {
493+ NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
494+ [formatter setDateFormat:APIDateFormat];
495+ return [formatter dateFromString:string];
496+ }
497+
498+ - (NSString *)JSONObjectFromNSDate:(NSDate *)date {
499+ NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
500+ [formatter setDateFormat:APIDateFormat];
501+ return [formatter stringFromDate:date];
502+ }
503+
504+ @end
505+
506+ ```
507+
486508* json validation
487- * data transformations
488509* error handling
489510* custom data validation
490511* automatic compare and equality features
You can’t perform that action at this time.
0 commit comments