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

The Archive Base Latest Questions

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

I am parsing the following JSON Message hereafter with the jQuery Function below. As

  • 0

I am parsing the following JSON Message hereafter with the jQuery Function below. As seen by observing the JSON Message, the second Object in the friends.data Array does not have any “statuses” Item, but only “name” and “id”, contrary to the first and last objects in the Main Array. Nevertheless, I am having issues parsing the entire Message since the $.each(friend.statuses, function(j, status) Function stops at the second Item (which does not have any “statuses” entry) without proceeding to the next one (last one in this example), which does contain a “statuses” Item. I have tried adding some logic before and after the $.each(friend.statuses, function(j, status) Function in order to verify if there is an existing Item (“statuses”), but without success. How could I “Skip” over this second Item in the Main Array, so that the second $.each Function continues to parse the Main Array until the end of the JSON Message.

Function:

$.each(response.friends.data, function(i, friend){
    $.each(friend.statuses, function(j, status){
        alert(status.message);
    });
});



JSON Message:

{   
    "id": "idValue",
    "friends": {
      "data": [
       {
         "name": "NameValue",
         "id": "idValue",
         "statuses": {
           "data": [
             {
               "message": "Msg1",
               "updated_time": "Date",
             },
             {
               "message": "Msg2",
               "updated_time": "Date",
             },
           ],
          }
       },

       {
         "name": "NameValue",
         "id": "idValue",
       }

       {
         "name": "NameValue",
         "id": "idValue",
         "statuses": {
           "data": [
             {
               "message": "Msg1",
               "updated_time": "Date",
             },
             {
           "message": "Msg2",
               "updated_time": "Date",
             },
           ],
         }
       }
     ],   
  }
} 
  • 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-12T21:10:22+00:00Added an answer on June 12, 2026 at 9:10 pm

    Check to see if the current friend object has statuses, if it doesn’t then continue to the next friend. You can do this by just doing: if(!friend.statuses) return;

    $.each(response.friends.data, function(i, friend){
        if(!friend.statuses) return;
        $.each(friend.statuses, function(j, status){
            alert(status.message);
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have json data in the following format {updates: {message :[[student:123]] is present.}, references:[{type:student,full_name:XYZ,id:123}]
What is wrong in parsing following JSON data '{ {errors: {firstname:is too short} },
I have the following JSON Object: [{id:123,username:test}] I want to parse username using javascript
I have the following code: try { < ... some JSON parsing code ..
I have the following scenario: I am parsing a JSON Response from a server
I have the following .ajax $.ajax({ url: urlpath, type: 'POST', dataType: 'json', data: JSON.stringify(json),
I am parsing json from the following url http://www.kaverisoft.com/careers/assignments/android/a1.php with the following code public
I have following code in which i am doing JSON parsing and showing results
I am parsing JSON and I get the following error: I am using the
I am parsing json data in iphone application. But it is not parsing it

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.