Web Development and Internet Marketing Forum
Login to your Warrior Account

Json Data Parsing Problem

Go down

Json Data Parsing Problem

Post by kevin619 on Tue Dec 27, 2011 12:38 pm

Hi everyone, I am new for iPhone. I have written a simple app for iPhone.

I have an Json web service and it has some methods. one of them is returning a array to iPhone.

Here is the response string and converting it to NSArray.

NSString *responseString = [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease];
NSLog(@"Did receive response: %@", responseString);

NSArray *resultsArray = [responseString JSONValue];

And When I check NSLog for ResultArray I received something like that

"id": "1",
"result": [
"Name": "John",
"Statu": "Online"
"Name": "Alex",
"Statu": "Online"
"Name": "Diaz",
"Statu": "Offline"

And after that i want to see how many object in this array or listing them. Here is code

resultsArray count gives always 2 i don't know why.

NSLog(@"count is: %i", [resultsArray count]);

and also This line gives an error

txtResponse.text = [resultsArray objectAtIndex:0];

Can anybody help me.


Posts : 38
Join date : 2011-12-19
Location : California

View user profile

Back to top Go down

Back to top

- Similar topics

Permissions in this forum:
You cannot reply to topics in this forum