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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:05:30+00:00 2026-05-26T02:05:30+00:00

Running over this string.. and Resorting it as needed on the fly { oozie:

  • 0

Running over this string.. and Resorting it as needed on the fly

{
"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": [
        {}
    ]
}
}

I have a string similar to that of the above, that changes rather frequently. Using Jquery I want to be able to sort this string on the fly in different mannors. One example Is I want to list all services specific to one host. Or Another is I want to List all services by service type.

Currently this string supports the by service type concept. However I am not really able to get the output to change to my whims so I have to work with what I got. That said whats the best way to sort this string or object I should actually be saying. So that I can show a block that would be all services in one particular host?

I’ve been trying to do it myself for a couple days and I haven’t gotten anywhere I just figure I need a fresh set of eyes on this to give me ideas cause the directions I run seem to road block me..

I have been trying each() in jquery where I nest a few each’s down in some trials to do what I want but again I am failing miserably.

EDIT
I figured its better to just rebuild the object based on the information I need from the original. I am however getting stuck in gathering that information. Basicly I want the hostsinfo and the main object name of hosts info.

so I would want to return:

oozie = hostid:1, details:.., currstatus:.., currstatusclass:..
oozie = hostid:2, details:.., currstatus:.., currstatusclass:..
oozie = hostid:3, details:.., currstatus:.., currstatusclass:..
(just imagine the above 3 lines in object format)

My Latest Failed attempt. Ive been at this for days and im starting to lose my mind.

$('.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);
    });
});
  • 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-26T02:05:30+00:00Added an answer on May 26, 2026 at 2:05 am

    Looking at your JSON structure, and assuming you have control over it I would change it slightly to make it an array of hosts, with the node name as a property. If you can’t change it I would parse it first to make an array that you can work with.

    I would then use the LINQ.js jQuery plugin to sort and select as needed.

    Check out the linq.js site here:

    http://linqjs.codeplex.com/

    And the LINQ.js linqpad and API reference here:

    http://neue.cc/reference.htm

    I’m not quite clear on how you want to sort this JSON. But as an example, lets assume your nodes are in a variable called “nodes” and we want to select the running hosts:

    var running = $.Enumerable.From(nodes).Where("$.hostsinfo.currstatus == 'Running'").ToArray()
    

    There are many more query operators that you can use, this is a simple example. Sub queries are also supported.

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

Sidebar

Related Questions

This is a bit of a vague notion which I have been running over
In a loop running over the entire string how do i peek at the
I'm scratching my head over this one. Below is a running sample. I have
I get a application running over: Rails 2.3.5, Application is set 2.1.0 at enviroment.rb
Hello we have an SQL server application running over a low bandwith connection. We
I have an MSI installer that fails if it is running over remote desktop.
I have a somewhat simple Client/Server solution running over C# remoting (System.Runtime.Remoting). The MarshalByRef
I've developed a print mechanism for an intranet application running over HTTPS. Using javascript
I've written a small (8-10 laptops) point-of-sale system running over a wireless network, as
How much of a performance hit will running everything over TLS do to my

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.