开发者

problem getting a value from a JSON array objective-c

Im receiving a JSON array from a UPX server and i cant get to a value

i need the object "name" from "relation_data" but i cant get into "relation_data"

this is how i do it

NSLog(@"All of the arrays: %@", json);
    NSDictionary *Allinfo = [json objectForKey:@"response"];//I go into "response"
    NSLog(@"All with response array: %@", Allinfo);
    NSDictionary *datainfo = [Allinfo objectForKey:@"data"];//i go into "data"
    NSLog(@"Data : %@", datainfo);

But how do i go into "relation_data" and get the value of "name"?

response = (    
data =     (
                        {
                    "business_data_rev" = 12;
                    "contact_set_rev" = 15;
                    currency = EUR;
                    "date_added" = "2011-08-31 12:10:59.338664+02";
                    "date_invoiced" = "2011-08-31 12:10:59.338664+02";
                    开发者_如何学C"date_modified" = "2011-08-31 12:11:04.45442+02";
                    "date_paid" = "2011-08-31 12:10:59.408335+02";
                    description = "";
                    id = 104;
                    name = "Invoice #104";
                    "person_rev" = 12;
                    realid = 104;
                    "relation_data" =             {
                        id = 12;
                        iscreditor = 0;
                        isdebitor = 1;
                        isprivate = 0;
                        name = "Emre.";
                        "subaccount_id" = 9;
                    };
        )


Try this

[dataInfo valueForKeyPath:@"relation_data.name"];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜