How to read JSON object
I have a JSON object like
{"status":"200","id":"23","username":"nipinponmudi@gmail.com","fname":"hh","laname":"hh","timezone":"2","createdate":"2011-09-20 22:05:24","key":"db3f57a8f2b9abd9d51916232f5a77b9"}
The object above is a response from a server.I want to display these objects in corresponding textfields on the viewdidload method.I want to r开发者_运维百科ead this object and display separately in textfields.I need to extract the username,fname,lname only.No need to read the status
take a look at https://github.com/stig/json-framework/ . I'm sure they are so many source and example out there to show you.
NSString *jsonString = @{"status":"200","id":"23","username":"nipinponmudi@gmail.com","fname":"hh","laname":"hh","timezone":"2","createdate":"2011-09-20 22:05:24","key":"db3f57a8f2b9abd9d51916232f5a77b9"}";
SBJsonParser *parser = [SBJsonParser new];
id object = [parser objectWithString:jsonString];
txtName.text = [object objectForKey:@"username"];
精彩评论