How can i fetch value from Json response in Objective -C

前端 未结 6 761
时光取名叫无心
时光取名叫无心 2021-02-11 11:40

I have a problem with fetching data from Json response.

Here is an example data structure :

(
     {
        AT = \"\";
        DId = 0;
            


        
6条回答
  •  再見小時候
    2021-02-11 12:19

    Use JSONKit(https://github.com/johnezang/JSONKit):

    NSString *yourJSONString = ...
    NSArray *responseArray = [yourJSONString objectFromJSONString];
    for(NSDictionary *responseDictionary in responseArray)
    {
        NSString *atString = [responseDictionary objectForKey:@"AT"];
        ...
        NSArray *pdCatListArray = [responseDictionary objectForKey:@"PdCatList"];
        ...here you can get all values you want,if you want to get more details in PdCatList,use for in pdCatListArray ,you can do what you want.
    }
    

提交回复
热议问题