Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8279543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:22:44+00:00 2026-06-08T09:22:44+00:00

i am new to ios development.. i have problem in getting arrays from complex

  • 0

i am new to ios development..
i have problem in getting arrays from complex json response.
so anyone have idea about it than please help me…
my json response is as below
and i want to get array of subcat_id and subcat_name

  (
    {
    0 =         {
        "subcat_id" = 2;
        "subcat_name" = Restaurants;
    };
    1 =         {
        "subcat_id" = 3;
        "subcat_name" = "Bar & Club";
    };
    "cat_id" = 1;
    "cat_name" = "Dining & Nightlife";
},
    {
    0 =         {
        "subcat_id" = 5;
        "subcat_name" = Massage;
    };
    1 =         {
        "subcat_id" = 6;
        "subcat_name" = Facial;
    };
    2 =         {
        "subcat_id" = 7;
        "subcat_name" = "Manicure / Pedicure";
    };
    3 =         {
        "subcat_id" = 8;
        "subcat_name" = Tanning;
    };
    4 =         {
        "subcat_id" = 9;
        "subcat_name" = "Hair Salon";
    };
    5 =         {
        "subcat_id" = 10;
        "subcat_name" = "Hair Removal";
    };
    6 =         {
        "subcat_id" = 11;
        "subcat_name" = Spa;
    };
    7 =         {
        "subcat_id" = 12;
        "subcat_name" = "Teeth Whitening";
    };
    8 =         {
        "subcat_id" = 13;
        "subcat_name" = "Eye & Vision";
    };
    9 =         {
        "subcat_id" = 15;
        "subcat_name" = "Cosmetic & Beauty Treatments";
    };
    "cat_id" = 4;
    "cat_name" = "Health & Beauty";
},
    {
    0 =         {
        "subcat_id" = 17;
        "subcat_name" = Pilates;
    };
    1 =         {
        "subcat_id" = 18;
        "subcat_name" = Yoga;
    };
    2 =         {
        "subcat_id" = 19;
        "subcat_name" = Gym;
    };
    3 =         {
        "subcat_id" = 20;
        "subcat_name" = "Boot Camp";
    };
    "cat_id" = 16;
    "cat_name" = Fitness;
},
    {
    0 =         {
        "subcat_id" = 22;
        "subcat_name" = "Men's Clothing";
    };
    1 =         {
        "subcat_id" = 23;
        "subcat_name" = "Women's Clothing";
    };
    2 =         {
        "subcat_id" = 24;
        "subcat_name" = "Food & Grocery";
    };
    3 =         {
        "subcat_id" = 25;
        "subcat_name" = "Wine & Liquor";
    };
    4 =         {
        "subcat_id" = 26;
        "subcat_name" = "Home Services";
    };
    5 =         {
        "subcat_id" = 27;
        "subcat_name" = "Rental Car/ Car Wash/ Car Repair";
    };
    6 =         {
        "subcat_id" = 53;
        "subcat_name" = "Product / Service Discounts";
    };
    "cat_id" = 21;
    "cat_name" = "Retail & Services";
},
    {
    0 =         {
        "subcat_id" = 29;
        "subcat_name" = Museums;
    };
    1 =         {
        "subcat_id" = 30;
        "subcat_name" = "Wine Tasting";
    };
    10 =         {
        "subcat_id" = 42;
        "subcat_name" = "Dance Classes";
    };
    11 =         {
        "subcat_id" = 50;
        "subcat_name" = "Family Fun";
    };
    2 =         {
        "subcat_id" = 31;
        "subcat_name" = "City Tours";
    };
    3 =         {
        "subcat_id" = 32;
        "subcat_name" = "Comedy Clubs";
    };
    4 =         {
        "subcat_id" = 33;
        "subcat_name" = Theater;
    };
    5 =         {
        "subcat_id" = 34;
        "subcat_name" = Concerts;
    };
    6 =         {
        "subcat_id" = 35;
        "subcat_name" = "Education & Personal Development";
    };
    7 =         {
        "subcat_id" = 36;
        "subcat_name" = Golf;
    };
    8 =         {
        "subcat_id" = 38;
        "subcat_name" = Bowling;
    };
    9 =         {
        "subcat_id" = 39;
        "subcat_name" = "Sporting Events";
    };
    "cat_id" = 28;
    "cat_name" = "Activities & Adventures";
},
    {
    0 =         {
        "subcat_id" = 44;
        "subcat_name" = Others;
    };
    1 =         {
        "subcat_id" = 56;
        "subcat_name" = "Accommodation and Holidays";
    };
    "cat_id" = 43;
    "cat_name" = Others;
},
    {
    0 =         {
        "subcat_id" = 46;
        "subcat_name" = "Pet Grooming Services";
    };
    "cat_id" = 45;
    "cat_name" = Pets;
},
    {
    0 =         {
        "subcat_id" = 52;
        "subcat_name" = "Car Servicing / Repairs";
    };
    "cat_id" = 51;
    "cat_name" = "Car Servicing / Repairs";
}
)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T09:22:45+00:00Added an answer on June 8, 2026 at 9:22 am

    What you have posted in your question isn’t JSON. It might have been originally transmitted as JSON data. But the post shows a data structure in the property list format. Note that some of the strings are HTML or XML encoded which will cause problems later. You should fix this at the source before transmitting it as JSON.

    Now the result you post is an array of dictionaries containing further dictionaries. The outmost array is a list of categories. Each category is given as a dictionary containg both its own name and ID as well as the subcategories. The innermost dictionaries are the subcategories containing their ID and name.

    The category dictionaries are somewhat problematic because the mix two things and are a mixture of a dictionary and an array. It’s difficult to access the subcategories.

    Your code could like like this:

    NSArray* categoryList = [someJSONParser parse];
    for (NSDictionary* category in categoryList ) {
        NSString* categoryName = [category objectForKey: @"cat_name"];
        NSNumber* categoryIdObj = [category objectForKey: @"cat_id"];
        int categoryId = [categoryIdObj intValue];
    
        int index = 0;
        NSDictionary* subcategory = [category objectForKey: [NSString stringWithFormat: @"%d", index] ];
        while (subcategory != nil) {
            NSString* subcategoryName = [subcategory objectForKey: @"subcat_name"];
            NSNumber* subcategoryIdObj = [subcategory objectForKey: @"subcat_id"];
            int subcategoryId = [subcategoryIdObj intValue];
    
            index++;
            subcategory = [category objectForKey: [NSString stringWithFormat: @"%d", index] ];
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello.Am new to ios development.What have to do for NSOpenPanel to work in the
First of all I have to say I am new to iOS development. My
I'm new in iOS development, and met this library linking problem in last few
I'm new to iOS development and I'm having trouble making a simple Json POST
I am new to iOS development so please bear with me. I have created
I'm new to iOS development so I'm confused. I have a ViewController, in this
I'm very new with iOS Development and I have just created one of my
I'm new to iOS development, I just have UITableViewController in a storyboard. I would
I am VERY new with iOS development. So, please make your response as exact
Since I am new to iOS development I have a few Questions. Firstly I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.