0

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";
                    "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;
                    };
        )

1 Answer 1

3

Try this

[dataInfo valueForKeyPath:@"relation_data.name"];
Sign up to request clarification or add additional context in comments.

3 Comments

hmm, if i do this i get all the names(104 records) in 1 variable for example a string, how can i get it 1 by 1?
try [[dataInfo objectAtIndex:0] valueForKeyPath:@"relation_data.name"]
Thanks solve this problem when i am add the dictionary and then set valueforkeypath.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.