i've a little json encode problem :
i need to encode an object format JSON with SBJSON before send it to a php server At the moment this sample code work :
NSArray *arrayData = [NSArray arrayWithObjects:
user.id == nil ? [NSNumber numberWithInt:-1] : user.id,
ProfessionField.text, NameField.text, RPPSField.text, RPPSField.text,
NameField.text, SurnameField.text, StreetField.text,
TownField.text, CpField.text, MailField.text,
PhoneField.text, FaxField.text, MobileField.text,
// [user.horaires JSONRepresentation],
nil];
NSArray *arrayKey = [NSArray arrayWithObjects:
@"id", @"spe", @"name", @"rpps", @"cip",
@"name", @"surname", @"rue",
@"ville", @"cp", @"mail",
@"tel", @"fax", @"port",
// @"horaires",
nil];
NSDictionary *dataBrut = [NSDictionary dictionaryWithObjects:arrayData forKeys:arrayKey];
NSDictionary *jsonDict = [NSDictionary dictionaryWithObject:dataBrut forKey:@"data"];
NSString *jsonRequest = [jsonDict JSONRepresentation];
The problem is when i need to send the "user.horaires" (here in comment) Application CRASH at the JSON representation of this object.
this object is an Array of the following class :
@interface Horaire : NSObject
{
BOOL morning;
}
@property (nonatomic, strong) NSNumber *id;
@property (nonatomic, strong) NSString *open;
@property (nonatomic, strong) NSString *close;
Someone know how to succes to encode this ?