I have use JSONModel framework to find out whats going on.
Note, please use camel case notation in your project.
Model classes (only header files are important in this case):
LanguageString.h
#import "JSONModel.h"
@protocol LanguageString;
@interface LanguageString : JSONModel
@property (strong, nonatomic) NSString *DataKey;
@property (strong, nonatomic) NSString *DataValue;
@property (strong, nonatomic) NSString *DataDescription;
@property (strong, nonatomic) NSString *DataLanguage;
@end
LanguagePack.h
#import "JSONModel.h"
#import "LanguageString.h"
@interface LanguagePack : JSONModel
@property(strong,nonatomic) NSArray<LanguageString> *Data;
@end
ResultObject
#import <Foundation/Foundation.h>
#import "JSONModel.h"
#import "LanguageString.h"
@interface ResultObject : JSONModel
@property (strong, nonatomic) NSArray<LanguageString> *Data;
@property (strong, nonatomic) NSString *ResultCode;
@property (strong, nonatomic) NSString *ResultMessage;
@property (strong, nonatomic) NSObject<Optional> *Exception;
@end
and then run:
NSString *json = @"{\"Data\":[{\"DataKey\":\"AppTemplate.CancelButton.Text\",\"DataValue\":\"Iptal\",\"DataDescription\":\"\",\"DataLanguage\":\"TR\"},{\"DataKey\":\"Exception.Code.7\",\"DataValue\":\"SMS dogrulama kodu hatali ya da zaman asimina ugramis.\",\"DataDescription\":\"SmsVerificationCodeNotVerifiedException\",\"DataLanguage\":\"TR\"},{\"DataKey\":\"Exception.Code.11\",\"DataValue\":\"Geçersiz dil bilgisi.\",\"DataDescription\":\"InvalidLanguageException\",\"DataLanguage\":\"TR\"}],\"ResultCode\":\"00\",\"ResultMessage\":\"Success\",\"Exception\":null}";
ResultObject *ro = [[ResultObject alloc] initWithString:json error:nil];
NSLog(@"ResultCode=%@, ResultMessage=%@", ro.ResultCode, ro.ResultMessage);
for (LanguageString *ls in ro.Data) {
NSLog(@"\n-----\nDataKey=%@\nDataValue=%@\nDataDescription=%@\nDataLanguage=%@\n-----", ls.DataKey, ls.DataValue, ls.DataDescription, ls.DataLanguage);
}
RESULT:
2014-01-24 14:46:31.050 Test[1420:70b] ResultCode=00, ResultMessage=Success
2014-01-24 14:46:31.052 Test[1420:70b]
-----
DataKey=AppTemplate.CancelButton.Text
DataValue=Iptal
DataDescription=
DataLanguage=TR
-----
2014-01-24 14:46:31.052 Test[1420:70b]
-----
DataKey=Exception.Code.7
DataValue=SMS dogrulama kodu hatali ya da zaman asimina ugramis.
DataDescription=SmsVerificationCodeNotVerifiedException
DataLanguage=TR
-----
2014-01-24 14:46:31.053 Test[1420:70b]
-----
DataKey=Exception.Code.11
DataValue=Geçersiz dil bilgisi.
DataDescription=InvalidLanguageException
DataLanguage=TR
-----
I hope it is what you are expecting, a ResultObject must define the type of the array, thats the only difference:
@property (strong, nonatomic) NSArray<LanguageString> *Data;