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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:39:38+00:00 2026-06-16T00:39:38+00:00

I have a json data and i want to split into 2 sets of

  • 0

I have a json data and i want to split into 2 sets of data arrays
One json data will hold all the values under “Construct” data values
and the 2nd json data will hold the rest of the araay and values for product and system.

How do I go about split the JSON into two?

{
    "html": [{
        "type": "fieldset",
        "caption": "Construct",
        "html": [{
            "title": "tooltip data for rk",
            "name": "rk_",
            "value": "24",
            "caption": "DNS Servers (a list of IP addresses separated by comas)",
            "type": "textarea"
        }, {
            "title": "tooltip data for rk_ntpservers",
            "name": "rk_ntpservers",
            "value": "111.11.11.11",
            "caption": " separated by comas",
            "type": "textarea"
        }, {
            "title": "tooltip data for ff_eth0_ff",
            "name": "ff_eth0_ff",
            "value": "18",
            "caption": "Public  Address (0.0.0.0 to disable)",
            "type": "text"
        }, {
            "title": "tooltip data for ff_eth0_netmask",
            "name": "ff_eth0_netmask",
            "value": "2.2.2.0",
            "caption": "Public rk Netmask",
            "type": "text"
        }, {
            "title": "tooltip data for ff_eth1_ff",
            "name": "ff_eth1_ff",
            "value": "0.0.0.0",
            "caption": "MG Device rk (0.0.0.0 to disable)",
            "type": "text"
        }, {
            "title": "tooltip data for ff_eth1_netmask",
            "name": "ff_eth1_netmask",
            "value": "2.2.2.0",
            "caption": "MG Device rk Netmask",
            "type": "text"
        }, {
            "title": "tooltip data for ff",
            "name": "ff_gateway",
            "value": "1",
            "caption": "Gateway",
            "type": "text"
        }]
    }, {
        "type": "fieldset",
        "caption": "Product",
        "html": [{
            "title": "tooltip data for product_ident",
            "name": "product_ident",
            "value": "78",
            "caption": "Product Name",
            "type": "text",
            "disabled": "disabled"
        }, {
            "title": "tooltip data for product_svnversion",
            "name": "product_svnversion",
            "value": "7916",
            "caption": "Revision",
            "type": "text",
            "disabled": "disabled"
        }]
    }, {
        "type": "fieldset",
        "caption": "System ",
        "html": [{
            "title": "tooltip data for system_license",
            "name": "system_license",
            "value": "HH",
            "caption": "License",
            "type": "text"
        }, {
            "title": "tooltip data for system_variant",
            "name": "system_variant",
            "value": "normal",
            "caption": "Variant",
            "type": "text"
        }]
    }, {
        "type": "fieldset",
        "class": "btn-fieldset",
        "caption": "",
        "html": [{
            "type": "submit",
            "id": "submitbtn",
            "class": "btn btn-primary",
            "value": "Save"
        }]
    }]
}

MY UPDATED CODE now wokring

I cant seem to output the Construct group data :(. But i can out put the resofJSONdata fine,

$(document).ready(function () // don't do anything until the document is loaded.
{

    var baseUrl = "configuration.json";

    $.getJSON(baseUrl, function (data) // call getJSON providing the complete url with search term and a JSONP callback
    {
        // console.log(data.html.splice(2,3));
        // console.log("data " +data);

        console.log(data.html.splice(3, 0)); // remove and log the empty fieldset
        var constructgrp = data.html.shift(); // remove the first item (caption: "Construct")

        var restofJSONdata = data.html;
        alert(constructgrp);

        $("#demo-3-form").empty(); // clear out any previous results.
        if (data.html.length < 1) $('#demo-3-forms').html("No results. Nada. Nuttin. Zippo.");

        //$("#demo-3-form").empty(); // clear out any previous results.
        // if (data.html.length < 1) $('#demo-3-forms').html("No results. Nada. Nuttin. Zippo.");
        //   $.each(this.constructgrp, function () // iterate over the results, constructing the HTML for the display.
        // {

        var html = constructgrp.type + ' :';
        html += '<b>' + constructgrp.caption + '</b><br>';

        html += ' <br>';
        $.each(constructgrp.html, function () {
            //  alert(this.name);
            html += 'Title :' + this.title + '<br>';
            html += 'Name :' + this.name + '<br>';
            html += 'Value :' + this.value + '<br> ';
            html += 'Caption :' + this.caption + '<br><br> ';
            // html += this.type +'<br><br> ';
        });
        $('#demo-3-form').hide().append(html).fadeIn(800); // fade in the results over 2 seconds.
        // });



        $.each(restofJSONdata, function () // iterate over the results, constructing the HTML for the display.
        {

            var html = this.type + ' :';
            html += '<b>' + this.caption + '</b><br>';

            html += ' <br>';
            $.each(this.html, function () {
                //  alert(this.name);
                html += 'Title :' + this.title + '<br>';
                html += 'Name :' + this.name + '<br>';
                html += 'Value :' + this.value + '<br> ';
                html += 'Caption :' + this.caption + '<br><br> ';
                // html += this.type +'<br><br> ';
            });
            $('#demo-3-form').hide().append(html).fadeIn(800); // fade in the results over 2 seconds.
        });


    });
    //});
});

html

  • 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-16T00:39:40+00:00Added an answer on June 16, 2026 at 12:39 am

    You seem to have confused .slice() with .splice(). While the first one extracts array items, the second one removes them. Maybe this is what you want:

    console.log(data.html.splice(3)); // remove and log the 4th item and everything after 
    var constructgrp = data.html.shift(); // remove the first item (caption: "Construct")
    var restofJSONdata = data.html; // take what is left over
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have some json data, and i want to convert it into plain text,
I have a JSON-like data structure (which I don't want to change) that is
I have 5 view which have deferent json data , in all my 5
I want to pass a JSON data structure to an MVC (3) Controller, have
I have a file which contains two JSON arrays; one is holding the column
I have JSON data like this: [{id:3,name:jason},{id:4,name:karen}] I want to build a table view
I have JSON data which come from server. I want to display organization chart
i have JSON data from php -it's one dimensional array-: {pair:[-8.5745000,115.3735700,-8.5683300,115.3733700,-8.5683300,115.3733700,-8.5687800,115.3997700,-8.5687800,115.3997700,-8.5764900,115.4007400,-8.5764900,115.4007400,-8.5687800,115.3997700,-8.5687800,115.3997700,-8.5656400,115.4156400,-8.5656400,115.4156400,-8.5565200,115.4122800,-8.5565200,115.4122800,-8.5566200,115.4110500,-8.5566200,115.4110500,-8.5560700,115.4112200,-8.5560700,115.4112200,-8.5554200,115.4112800,-8.5554200,115.4112800,-8.5527200,115.4025400,-8.5527200,115.4025400,-8.5424000,115.4027000,-8.5424000,115.4027000,-8.5426600,115.4055800,-8.5426600,115.4055800,-8.5377000,115.4057200,-8.5377000,115.4057200,-8.5375900,115.4034500,-8.5375900,115.4034500,-8.5358900,115.4036500,-8.5358900,115.4036500,-8.5358800,115.4033400]} and in android
I have about 7000 lines of JSON data that I want to parse. An
I have JSON response from Facebook, which I don't want to deserialize into a

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.