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 9016121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:54:52+00:00 2026-06-16T03:54:52+00:00

I have 2 cases to parse JSON First is: { post_filter_data: { Items: [

  • 0

I have 2 cases to parse JSON First is:

{
    "post_filter_data": {
        "Items": [
            {
                "ItemID": "50cb4e46b5d30b0002000009",
                "ItemName": "Fruit salad test",
                "ItemPrice": "122.0",
                "ItemDescription": "test test",
                "ItemImageUrl": "http://s3.amazonaws.com/menubis-mms-prototype-dev/menubis/assets/50cb4e64b5d30b0002000013/landing_page.jpg?1355501156"
            },
            {
                "ItemID": "50d0870d910ef2000200000a",
                "ItemName": "test new",
                "ItemPrice": "120.0",
                "ItemDescription": null,
                "ItemImageUrl": "http://s3.amazonaws.com/menubis-mms-prototype-dev/menubis/assets/50d0871a910ef20002000015/Screenshot-2.png?1355843354"
            }
        ]
    }
}

in which Items is an NSArray and it’s parse easily but when only one object I get its through exception.
Second JSON is in which Items tag has one one object:

{
    "post_filter_data": {
        "Items": {
            "ItemID": "50d1e9cd9cfbd20002000016",
            "ItemName": "test",
            "ItemPrice": "120.0",
            "ItemDescription": "test",
            "ItemImageUrl": "http://s3.amazonaws.com/menubis-mms-prototype-dev/menubis/assets/50d1ea019cfbd20002000022/11949941671787360471rightarrow.svg.med.png?1355934209"
        }
    }
}

and my code is here In which I am parsing it:

NSDictionary *dictMenu=[responseDict valueForKey:@"post_filter_data"];
NSArray* subMenuArray=[dictMenu valueForKey:@"Items"];

Is there any way in which I check it out that valueForKey:@"Items" is Array or Object.

  • 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-16T03:54:53+00:00Added an answer on June 16, 2026 at 3:54 am

    Get data rx in _recievedData then check the class of the object.

        id object = [NSJSONSerialization
                         JSONObjectWithData:_recievedData
                         options:kNilOptions
                         error:&error];
        if (error)
        {
             NSLog(@"Error in rx data:%@",[error description]);
        }
        if([object isKindOfClass:[NSString class]] == YES)
        {
             NSLog(@"String rx from server");
        }
        else if ([object isKindOfClass:[NSDictionary class]] == YES)
        {
             NSLog(@"Dictionary rx from server");
        }
        else if ([object isKindOfClass:[NSArray class]] == YES)
        {
             NSLog(@"Array rx from server");
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some test cases. The test cases rely on data which takes time
I have created 5 test cases in JUnit 4 and I was wondering is
Suppose I have several small test cases. Easy enough to setup and easy enough
I am deserializing strings using JSON.parse . Most of the time, I have a
I have this variable which is json-like string, error appear while parse to a
Possible Duplicate: How to parse JSON in JavaScript If you have JSON formatted like
I am trying to parse Json response from This URL . I have used
I have this JSON to parse {files_informations: { row:{value:artist1}, row:{value:artist2} } } I would
I have a FCGI application written in C. We have cases where a client
I have two cases to match: either # ... ([0-9]+,[0-9]+) € ... # or #

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.