I'm creating a simple app which asks to the user to put a text inside a text field, this text is sent to a php script on an application server, the script performs a search on a database and send the result back to tha app formatted as JSON
With this code I print the response into the console
Data in the console appear like this
How do I print only the values and not the keys?
In example I want to print this:
barca.jpg - Una barca
form.jpg - Immagine di una form
bmw.jpg - una BMW
With this code I print the response into the console
Code:
NSString *response = [[[NSString alloc] initWithData:dati encoding:NSASCIIStringEncoding] autorelease];
NSMutableArray *jsonarray = [response JSONValue];
for (int i=0; i<[jsonarray count]; i++) {
NSLog(@"jsonarray: %@", [jsonarray objectAtIndex:i]);
}
Code:
2011-07-05 09:45:51.632 RecuperoInfo[20391:207] jsonarray: {
img = "barca.jpg";
testo = "Una barca";
}
2011-07-05 09:45:51.637 RecuperoInfo[20391:207] jsonarray: {
img = "form.jpg";
testo = "Immagine di una form";
}
2011-07-05 09:45:51.646 RecuperoInfo[20391:207] jsonarray: {
img = "bmw.jpg";
testo = "Una BMW";
}
In example I want to print this:
barca.jpg - Una barca
form.jpg - Immagine di una form
bmw.jpg - una BMW