2
Array 

DAATA (
            (
                    {
                Description = "<p>Image3</p>";
                "Image_Id" = 68;
                "Image_Path" = "aa6b74d47227ebd24561211a2c95199c.jpg";
                "Product_Address" = "Jaipur ,Rajastha";
                "Product_Booked" = N;
                "Product_Id" = 1;
                "Product_Info" = "The Indian Hotels Company Limited (IHCL) and its subsidiaries are collectively known as Taj Hotels Resorts and Palaces and is recognised as one of Asia's largest and finest hotel company. Incorporated by the founder of the Tata Group, Mr. Jamsetji N. Tata, the company opened its first property, The Taj Mahal Palace Hotel, Bombay in 1903. The Taj, a symbol of Indian hospitality, completed its centenary year in 2003. ";
                "Product_Latitude" = "26.9260\U00b0N";
                "Product_Longitute" = "75.8235\U00b0E";
                "Product_Name" = demo1;
                "Product_Offer_Price" = "$200";
                "Product_Price" = "$345";
                "Product_Type" = "five star";
            },
                    {
                Description = "<p>yo yo</p>";
                "Image_Id" = 75;
                "Image_Path" = "415e2e6b7a3b1850e06467ade2e10fa9.jpg";
                "Product_Address" = "jaipur,rajasthan";
                "Product_Booked" = N;
                "Product_Id" = 2;
                "Product_Info" = "five star";
                "Product_Latitude" = "";
                "Product_Longitute" = "";
                "Product_Name" = "hotel night rider";
                "Product_Offer_Price" = "$200";
                "Product_Price" = "$345";
                "Product_Type" = "five star";
            }
        )
    )
3
  • first write your code ...then i suggest to u .!! Commented Dec 11, 2012 at 9:56
  • check my answer stackoverflow.com/questions/12580407/… Commented Dec 11, 2012 at 13:36
  • it seems your values have been already extracted, otherwise how could you even post them...? Commented Apr 25, 2014 at 11:38

3 Answers 3

1
 NSString *responseString = [request1 responseString];//your json response will be here
 NSMutableDictinoary *dataDict = [[[responseString JSONValue] valueForKey:@"DAATA"]mutableCopy];//take response in dictinoary
 for(int i = 0 ; i<[[dataDict valueForKey:@"DAATA"] count];i++)
{
    if([[[[dataDict valueForKey:@"DAATA"] objectAtIndex:i] valueForKey:@"Image_Id"] isEqualToString:@"court"])//get what you want here for example get "Image_Id"
    {
        NSMutableDictionary *dd=[[dataDict valueForKey:@"result"] objectAtIndex:i];
        [arrCourt addObject:dd];
    }
   and so on.........

}
Sign up to request clarification or add additional context in comments.

Comments

0

Check out NSJSONSerialization and use it to parse your json string.

Comments

0

Another alternative is to use SBJson library.

- (void) connectionDidFinishLoading:(NSURLConnection *) conn 
{
//Call back called when data reception completes (stored in variable data)
NSString *jsonString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSDictionary *results = [jsonString JSONValue]; // This is a new category added to the NSString by SBJSON
if ([results count]>0)
{ 
    // decoding a JSON object like so: {"result":"yes"}
    [results objectForKey:@"result"] ;
    if ([[results objectForKey:@"result"] isEqualToString:@"yes"])
    {
        [self registrationStateSetTo:YES];
        NSLog(@" registered OK "); 
    }
    else 
    {
        [self registrationStateSetTo:NO];
        NSLog(@" registration failed "); 
    }
}
}

Comments

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.