I'm using json_encode on a two dimensional array in a PHP script like so:
$myjsons[] = json_encode(array($runners));
And also MANY single dimensional arrays later in the script:
$myjsons[] = json_encode(array($mrow));
I then echo after encoding the entire array at the end of the script:
echo json_encode($myjsons);
I'm working on an iOS app that communications with this service. Well, at least it is suppose to. Here is the iOS code minus error checking: (I'm using JSONKit, btw)
NSMutableURLRequest *urlReq = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:kStartRaceURL]];
[urlReq setHTTPMethod:@"GET"];
NSError *requestError;
NSURLResponse *urlResponse = nil;
NSData *response = [NSURLConnection sendSynchronousRequest:urlReq returningResponse:&urlResponse error:&requestError];
NSArray *deserializedData = [response objectFromJSONData];
The deserializedData is an array, but all objects within it are strings. I put arrays in it though, as shown in the PHP, so why are they NSString's? Where is the problem with the implementation? Or should I do something with the NSString's?