Я пытаюсь разобрать эту строку .... но из-за ключа "message_of_the_day" , JSON не может распознать строку, так как она содержит символы новой строки (\ n). Как бы я проанализировалэта строка JSON, остальные веб-сервисы JSON прекрасно работают для меня.
Ответ Json:
{"tblMessageOfTheDay":[{"customer_id":"1659","application_id":"1001","message_of_the_day":"Set your Message
GDSFSFDS
SF
ADS
DSFS
F"}]}
Код:
Я приложил немало усилий, чтобы решить эту проблему ....., но проблема все еще та же.
-(void)DataCollectedSuccessfully:(NSString *)responseString
{
NSDictionary *results = [responseString JSONValue]; // Main code .. with didn;t work
id result = [responseString JSONValue]; // I tried for it, it that object won;t get recognized, but this trick didn't work.
NSLog(@"%@",result);
NSDictionary *results = [[responseString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] JSONValue]; // Even tried to remove the newLine characters & extra space.
}
Ошибка:
-JSONValue failed. Error trace is: (
"Error Domain=org.brautaset.JSON.ErrorDomain Code=5 \"Unescaped control character '0xa'\" UserInfo=0x6235db0 {NSLocalizedDescription=Unescaped control character '0xa'}",
"Error Domain=org.brautaset.JSON.ErrorDomain Code=3 \"Object value expected for key: message_of_the_day\" UserInfo=0x6224a50 {NSUnderlyingError=0x6235e00 \"Unescaped control character '0xa'\", NSLocalizedDescription=Object value expected for key: message_of_the_day}",
"Error Domain=org.brautaset.JSON.ErrorDomain Code=3 \"Expected value while parsing array\" UserInfo=0x6224a80 {NSUnderlyingError=0x6235d20 \"Object value expected for key: message_of_the_day\", NSLocalizedDescription=Expected value while parsing array}",
"Error Domain=org.brautaset.JSON.ErrorDomain Code=3 \"Object value expected for key: tblMessageOfTheDay\" UserInfo=0x6224af0 {NSUnderlyingError=0x6224ab0 \"Expected value while parsing array\", NSLocalizedDescription=Object value expected for key: tblMessageOfTheDay}"
)