0

Im trying to clean up a json stream and get the error listed above

NSString *traveladvice = [json valueForKeyPath:@"travel_advice_article.travel_advice_sections.body.markup"];

which gets me a stream with lots of javascript regular expressions like \U00a0 which I want to remove. Im using to regexlite to remove.

NSString *regexString = @"U00a0"; 
NSString *replacementString = @"";
NSString *travelparse1 = nil; 

travelparse1 = [travelAdvice stringByReplacingOccurrencesOfRegex:regexString     
withString:replacementString];  

I understand the error but whats confusing me is that traveladvice is an NSString not an NSArray.

Mat
  • 202,337
  • 40
  • 393
  • 406
Coasty
  • 49
  • 1
  • 5

1 Answers1

0

json valueForPath might return an array, not a string. stop in a debugger and do 'po traveladvice' it will show you the actual data.

also, store the result type as 'id' and not NSString* to avoid confusion

reflog
  • 7,587
  • 1
  • 42
  • 47