Following this example of JSONModel
#import "CountryModel.h"
...
NSString* json = (fetch here JSON from Internet) ...
NSError* err = nil;
CountryModel* country = [[CountryModel alloc] initWithString:json error:&err];
I mimic it this way
// Here is the class #import "JSONModel.h"
@interface OrderNumberModel : JSONModel
@property (strong, nonatomic) NSString* OrderNumber;
@property (strong, nonatomic) NSString* OrderDate;
@end
NSString* json = (fetch here JSON from Internet) ...
NSError* err = nil;
OrderNumberModel *order = [[OrderNumberModel alloc] initWithString:result error:&err];
NSLog(@"Order Number: %@ Order Date: %@", order.OrderNumber, order.OrderDate);
if the class init method is initWithString how can I fetch json as string? most of the examples I have seen does is as NSData. the url of my local server method return a new orderNumber and the current date. NSURL *url = [NSURL URLWithString:@"http://myserver/service/api/punumber/"]
returns =>["13025","11/12/2013 2:26:24 PM"] Thanks.