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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:46:08+00:00 2026-05-26T01:46:08+00:00

{ oozie: { admin: {}, hosts-list: [ 1 ], hostsinfo: [ { host-id: 1,

  • 0
{
"oozie": {
    "admin": {},
    "hosts-list": [
        "1"
    ],
    "hostsinfo": [
        {
            "host-id": "1",
            "details": "Failed ProcessHealthMonitor health check 1 times consecutively",
            "currstatus": "Warning",
            "currstatusclass": "warning"
        },
        {
            "host-id": "2",
            "details": "Failed ProcessHealthMonitor health check 1 times consecutively",
            "currstatus": "Warning",
            "currstatusclass": "warning"
        },
        {
            "host-id": "4",
            "details": "Failed ProcessHealthMonitor health check 1 times consecutively",
            "currstatus": "Warning",
            "currstatusclass": "warning"
        },
        {
            "host-id": "5",
            "details": "Failed ProcessHealthMonitor health check 1 times consecutively",
            "currstatus": "Warning",
            "currstatusclass": "warning"
        }
    ],
    "status": [
        {}
    ]
},
"single-namenode": {
    "admin": {},
    "hosts-list": [
        "1"
    ],
    "hostsinfo": [
        {
            "host-id": "1",
            "details": "Running Service",
            "currstatus": "Running",
            "currstatusclass": "success"
        }
    ],
    "status": [
        {}
    ]
},
"single-database": {
    "admin": {},
    "hosts-list": [
        "1"
    ],
    "hostsinfo": [
        {
            "host-id": "1",
            "details": "Running Service",
            "currstatus": "Running",
            "currstatusclass": "success"
        }
    ],
    "status": [
        {}
    ]
},
"secondarynamenode": {
    "admin": {},
    "hosts-list": [
        "1"
    ],
    "hostsinfo": [
        {
            "host-id": "1",
            "details": "Running Service",
            "currstatus": "Running",
            "currstatusclass": "success"
        }
    ],
    "status": [
        {}
    ]
},
"datanode": {
    "admin": {},
    "hosts-list": [
        "1"
    ],
    "hostsinfo": [
        {
            "host-id": "1",
            "details": "Failed HttpHealthMonitor health check 2 times consecutively",
            "currstatus": "Warning",
            "currstatusclass": "warning"
        }
    ],
    "status": [
        {}
    ]
},
"web": {
    "admin": {},
    "hosts-list": [
        "1"
    ],
    "hostsinfo": [
        {
            "host-id": "1",
            "details": "Setting Master IP",
            "currstatus": "Dead",
            "currstatusclass": "error"
        }
    ],
    "status": [
        {}
    ]
},
"tasktracker": {
    "admin": {},
    "hosts-list": [
        "1"
    ],
    "hostsinfo": [
        {
            "host-id": "1",
            "details": "Running Service",
            "currstatus": "Running",
            "currstatusclass": "success"
        }
    ],
    "status": [
        {}
    ]
},
"jobtracker": {
    "admin": {},
    "hosts-list": [
        "1"
    ],
    "hostsinfo": [
        {
            "host-id": "1",
            "details": "Running Master Service",
            "currstatus": "Running",
            "currstatusclass": "success"
        }
    ],
    "status": [
        {}
    ]
}
}

Ive been at it for days trying to figure this one out and I just can’t nail it. I have no control over the actual JSON object and how its output looks like. However I have an entirely different need for it that in its current structure has posed nothing but issues for me.

What I want to do preferably with jQuery is

get the names of the Main objects
Oozie, Single-namenode, single-database, secondarynamenode, etc…
and rebuild an object for storage that follows a more practical format for use.

What I would like to see in the end is a new object that looks similar to

{ 
  "myservices":{[
     {"name":"oozie", "host-id": "1", "details":"failed process health monitor....", "currstatus":"Warning", "currstatusclass":"warning"},
     {"name":"oozie", "host-id": "2", "details":"failed process health monitor....", "currstatus":"Warning", "currstatusclass":"warning"},
     {"name":"oozie", "host-id": "3", "details":"failed process health monitor....", "currstatus":"Warning", "currstatusclass":"warning"},
     {"name":"oozie", "host-id": "4", "details":"failed process health monitor....", "currstatus":"Warning", "currstatusclass":"warning"},
     {"name":"oozie", "host-id": "5", "details":"failed process health monitor....", "currstatus":"Warning", "currstatusclass":"warning"},
     {"name":"single-namenode", "host-id": "2", "details":"failed process health monitor....", "currstatus":"Warning", "currstatusclass":"warning"}

  ]}

My Latest failed attempt is:

$('.refreshAllb').click(function() {
    var outputCon = '';
    $.getJSON('services.json', function(data) {
        $('#master_service_container').empty();
        $.each(data, function(i, object){
            $.each(object, function(property, value){
                if(property == "hostsinfo")
                {
                    $.each(value, function(propertyX, valueX){
                        outputCon += propertyX[valueX] +'<br>';
                    });
                }
            });
        });
        $('#master_service_container').html(outputCon);
    });
});

As I said Im Ive been at this for days I am at my wits end, any help is greatly appreciated.

  • 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-26T01:46:09+00:00Added an answer on May 26, 2026 at 1:46 am

    Here’s an example. Note that your required output is invalid JSON. The myservices property cannot be an object and array as in your example. It should be either an object (associative array) or a standard javascript array:

    var input = ... the original object
    
    var output = { myservices: [] };
    for (var key in input) {
        if (input.hasOwnProperty(key)) {
            for (var i = 0, hostsinfo = input[key].hostsinfo; i < hostsinfo.length; i++) {
                output.myservices.push({
                    'name': key,
                    'host-id': hostsinfo[i]['host-id'],
                    'details': hostsinfo[i]['details'],
                    'currstatus': hostsinfo[i]['currstatus'],
                    'currstatusclass': hostsinfo[i]['currstatusclass']
                });
            }
        }
    }
    
    // TODO: use the output
    

    Live demo.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sample String: var output = { myservices:[ {name:oozie, hostidn: 1, details:failed process health monitor....,
The command : oozie job -oozie http://localhost:8080/oozie -config /home/hadoop/Desktop/Cloudera/oozie-2.3.0-cdh3u1/examples/apps/no-op/job.properties -run Error message: Error: IO_ERROR
I'm trying to run a Cascading job using Oozie. I am getting a java.lang.ClassNotFoundException:
Running over this string.. and Resorting it as needed on the fly { oozie:
I am running this code using oozie workflow and getting type mismatch error: public
I'm trying to port a computer game from windows to GNU/Linux. It uses Ogre3D,CEGUI,
I am using Python and have to work on following scenario using Hadoop Streaming:
I have been using Hadoop quite a while now. After some time I realized
Is that even possible? I've searched quite a bit and I'd say it's not
Every time i run a hadoop job inside my main method, the only thing

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.