Data from JSON



  • Trying to dissolve JSON. I' data:

    NSDictionary *res = [NSJSONSerialization JSONObjectWithData:mutableData options:NSJSONReadingMutableLeaves error:&myError];
    

    I'm pulling out and seeing this structure:

    {
    response =     {
        items =         (
                        {
                created = "Thu Jan 01 1970 00:00:00 GMT+0000 (UTC)";
                to = "sdfs";
                from = "blabla";
                id = 472;
                price = 58;
            }
        );
    };
    

    I need to get the meaning of the "id" element, so I'm doing it:

    NSDictionary *response = [res objectForKey:@"response"];
    NSDictionary *items = [response objectForKey:@"items"];
    NSString *orderID = [items valueForKey:@"id"];
    NSLog(@"%@",orderID);
    

    And in leagues, I get that:

    (
    472   )
    

    I mean, not just a number, but a number of brackets, gaps and a new line.



  • Maybe NSString * orderID = [items objectForKey:@id]



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2