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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:19:10+00:00 2026-06-13T23:19:10+00:00

for (NSArray *values in [serializedJSON allValues]) Sometimes the values in serializedJSON will be arrays,

  • 0
for (NSArray *values in [serializedJSON allValues])

Sometimes the values in serializedJSON will be arrays, and sometimes they will be NSDictionaries. I would like to discriminate against one of them so I don’t get any errors like I am now. So I only want the returning values in this case to be NSArrays, while in a second case I would only want them to be NSDictionaries.

Thanks in advanced!

If you need more info let me know

  • 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-13T23:19:11+00:00Added an answer on June 13, 2026 at 11:19 pm

    The standard, generic way to handle JSON is roughly as follows:

    NSObject* jsonResult = [serializedJSON allValues];
    if ([jsonResult isKindOfClass:[NSArray class]]) {
       <handle NSArray>
    }
    else if ([jsonResult isKindOfClass:[NSDictionary class]]) {
       <handle NSDictionary>
    }
    else if ([jsonResult isKindOfClass:[NSNumber class]]) {
       <handle NSNumber>
    }
    else if ([jsonResult isKindOfClass:[NSString class]]) {
       <handle NSString>
    }
    else if (jsonResult == [NSNull null]) {
       <handle null>
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have an NSArray with some values in them. Is there a way
I have an NSArray of NSDictionaries each of which has 4 key values. I'm
-(NSArray*)getNeighbors{ NSArray *values = [neighbors allValues];//neighbors is NSMutableDictionary return values; } I have a
I used, for(id value in values) to get the value from an NSArray. Now
I need to check my values from NSArray which are stored dynamically. How should
So I have one NSArray that has names of documents to be presented in
I'v run into such problem. I need to update the values in my NSArray.
I have two questions regarding an NSArray: How can I add nil values to
I want to add NSArray with NSString values in it. I'm almost sure that
Let's say I have an NSArray of NSDictionaries that is 10 elements long. 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.