I just checked with my sample line. ** If you could give me your line, I could check out my next code sample.
NSString *msg = [NSString stringWithFormat:@"tell me \"where\"\n" "is\n" "wrong"]; NSData *theData = [msg dataUsingEncoding:NSASCIIStringEncoding]; NSString* theString = [[NSString alloc] initWithData:theData encoding:NSASCIIStringEncoding]; BOOL isValid = [NSJSONSerialization isValidJSONObject:theString]; NSLog(@"Value %d %@",isValid, theString);
For me, the value comes 0 and says "where"
is an
wrong
source share