TouchCode/TouchJSON — Issue #16: Deserialization does not work for me
Author: jlebright
Created: 2011-10-25 14:12:12+00:00
State: open

Here is my json:
{
"siteinfo": [
{
"title": "My Title",
"address": "My Addres",
"phone1": "(559) 426-4444",
"welcomeMessage": "msg",
"mainLogoUrl": "data:image/png;base64, iVBORw0KG..."
}
]
}

Of course I truncated the base64 data since it is rather large.

Here is my objective c code:
//This was my first attempt, it gave me an error in CJSONScanner.m (theData.Length was null!!!)
//NSData *theJSONData = jsonResult;
//NSError *theError = nil;
//id theObject = [[CJSONDeserializer deserializer] deserialize:theJSONData error:&theError];

//This is my second attempt:

NSString *jsonString = jsonResult;
NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
NSError *error = nil;
NSDictionary *dictionary = [[CJSONDeserializer deserializer] deserializeAsDictionary:jsonData error:&error];

In this case no error and data.length equals zero in CJSONScanner.m (which seems wrong) an I cannot see anything in *dictionary -print *dictionary gives me the following:

(gdb) print *dictionary
$1 = {
= {
isa = 0xe4880c
}, }

I have verified my json works fine with a javascript library I use so I am at a loss here. I am suspecting I am misusing your library ???

Thanks for any help in advance,

Joe Ebright