Web Development and Internet Marketing Forum
Login to your Warrior Account

Join the forum, it's quick and easy

Web Development and Internet Marketing Forum
Login to your Warrior Account
Web Development and Internet Marketing Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Json Data Parsing Problem

Go down

Json Data Parsing Problem Empty Json Data Parsing Problem

Post by kevin619 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];
NSLog(@"%@",resultsArray);


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.

kevin619

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

Back to top Go down

Back to top

- Similar topics

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