I did it easily in Android but Im little lost how to do it in iOs. My json is like:
[{"name":"qwe","whatever1":"asd","whatever2":"zxc"},
{"name":"fgh","whatever1":"asd","whatever2":"zxc"}]
If I do:
NSData *jsonData = [data dataUsingEncoding:NSUTF32BigEndianStringEncoding];
rows = [NSJSONSerialization JSONObjectWithData: jsonData options: NSJSONReadingMutableContainers error: &error];
in rows can I access with?
NSString *name = [[rows objectAtIndex:0] [objectForKey:@s"name"]];
Or how I do that? thanks.
FINALLY NSString *name = [[rows objectAtIndex:0] objectForKey:@"name"]]; WORKS! :D
I think that will work, however you want:
NSString *name = [[rows objectAtIndex:0] objectForKey:@"name"];
(dropped extraneous square brackets and use @"name" as string literal).
However, is the input JSON really in UTF-32 format?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With