help me to parse JSON value using JSONTouch

后端 未结 2 1115
-上瘾入骨i
-上瘾入骨i 2021-01-26 12:57

I have the following json:

http://www.adityaherlambang.me/webservice.php?user=2&num=10&format=json

I would like to get all the name in this data by the f

2条回答
  •  误落风尘
    2021-01-26 13:45

    It seems to me that when you create the "users" dictionary you are actually creating a "user" dictionary.

     NSDictionary *users = [[results objectForKey:@"users"] objectForKey:@"user"];//crating users dictionary with 1 "user" inside.
    

    EDIT

    in second view. why don't you just iterate the "result" dictionary? like that -

     for (NSDictionary *user in result){
      //NSLog(@"key:%@, value:%@", user, [user objectForKey:user]);
      NSString *title = [users objectForKey:@"NAME"];
      NSLog(@"%@", title);
     }
    

    hope it will help shani

提交回复
热议问题