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

  • SEARCH
  • Home
  • 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 7606397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:24:00+00:00 2026-05-31T00:24:00+00:00

UDPATE: SO WHATS THE BEST WAY TO ILLITERATE THROUGH A MULTI DIMENSIONAL ARRAY. SO

  • 0

UDPATE: SO WHATS THE BEST WAY TO ILLITERATE THROUGH A MULTI DIMENSIONAL ARRAY. SO CHECKING FOR OBJECTS INSIDE COMPLEX ARRAYS AND GRABBING THEIR VALUES.


{ "error":{
      "data": {
             "id":"3",
             "name":"404",
             "content" : "value"
       },
      "response":"Invalid path.",
      "code": 1
   }
}

if(json.error.data  !== undefined) {
      alert('value: ' + json.error.data);
}

I’m having an issue here; I can’t seem to correctly resolved. When I try to check an array for a value it returns the error “Uncaught TypeError: Cannot read property ‘data’ of undefined” if the array data doesn’t exist or content isn’t present. I know there is a way to use indexOf() to test if the value is present, but this doesn’t help me. I need to test for that value and then capture it. Remember, this is a multidimensional array so just using indexOf won’t necessarily locate the complexity of the array and how to locate it.

Ok, so put simply. I need to say, does the array data and the parameter content exist in the error array shown above. If it does, then capture it’s value and do something.

I also read about jQuery.inArray(); I don’t know how to utilize this for complex multidimensional arrays.

Is the only successful way to do this using a loop for( x in z) {}

  • 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-05-31T00:24:01+00:00Added an answer on May 31, 2026 at 12:24 am

    To test for undefined, use typeof and the string 'undefined'.

    Also, check for the existence of the .error parent property of .data after parsing the string into JSON. It isn’t clear from your code whether that has actually been done.

    var obj = JSON.parse(json);
    
    if (typeof obj.error !== 'undefined') {
      if(typeof obj.error.data  !== 'undefined') {
            alert('value: ' + obj.error.data);
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Whats the best way to take data from a datareader and manipulate that data,
whats the best way to refresh data in a UITableView, lets say data is
I'm trying to figure out whats the best way to get checkboxes to properly
Whats the best to way, based on the input below, to get everything in
What's the best way to clone a control in Silverlight (including it's children)? UPDATE
What is the best way to update a Java or GWT program from MySQL.
What is the best way to refresh a DataGridView when you update an underlying
What is the best way to communicate with another process in PHP? Update: Using
What is the best way to get back the XAML/XML value of a FlowDocument?
What the best way to get custom post-processing after binding to a backing bean,

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.