Search code examples
iphoneobjective-ciosjson-frameworksbjson

JSON Parse Error


I am using SBJson framework (also known as json-framework) for the iOS.

When parsing a certain JSON file, I am getting the following error: -JSONValue failed. Error is: Unescaped control character [0x09]'

I have used this framework many times and I am also parsing a very similar JSON file (that is even much longer) in that same app and it's working fine.

I tried throwing around a bunch of NSLogs and everything seems to be fine. Can someone please point me to what this error means, or at least how to go ahead in debugging such an error?

Here is the code that displays the error:

- (void)downloadSchedule:(NSString *)jsonString {

    // Get JSON feed URL and instantiate a dictionary object with its content
    NSDictionary *topDic = [jsonString JSONValue];

    NSLog(@"topDic count %d", [topDic count]);

topDic is showing a count of 0. The error is at the [jsonString JSONValue] line.

Thank you


Solution

  • I guess your file contain an unencoded tab (ascii 0x09) that should be replaced with \t according to the json grammar.