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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:44:58+00:00 2026-06-15T15:44:58+00:00

I need to nest an array I’ve created in JSON inside of another array

  • 0

I need to nest an array I’ve created in JSON inside of another array to give it proper formating for jQuery Datatables library.

Here is my current code:

$.ajax({
    url: uMtbls,
    dataType: 'json',
    success: function(jMtbl) {
        $.each(jMtbl, function(i, item) {
            mAll = jMtbl[i];
            mOwn = jMtbl[i].OrigOwner;
            mPub = jMtbl[i].PublicationTblNm;
            mTbl = jMtbl[i].TableId;
            mMig = jMtbl[i].MigrationFreq;
            mGTYPE = jMtbl[i].GTYPE;
            exec();

        });

        oTable = $('#dtManaged').dataTable({
            "bStateSave": true,
            "bProcessing": true,
            "bServerSide": true,
            "aaData": jReform,
            "aoColumns": [{
                "sName": mOwn,
                "sTitle": "Original Owner",
                "sWidth": "10%"
            }, {
                "sName": mPub,
                "sTitle": "Table Name"
            }, {
                "sName": mTbl,
                "sTitle": "ID"
            }, {
                "sName": mMig,
                "sTitle": "Migration Frequency"
            }, {
                "sName": mGTYPE,
                "sTitle": "Oracle Gtype"
            }],
            "sPaginationType": "full_numbers",
            "iDisplayLength": 25,
            "aLengthMenu": [
                [25, 50, 100, -1],
                [25, 50, 100, "All"]
            ]
        });
    }
});

function exec() {
    jBld = mOwn + "," + mPub + "," + mTbl + "," + mMig + "," + mGTYPE;
    //console.debug("[" + mOwn + "," + mTbl + "]");
    jReform = jBld.split(",");
    console.debug(jReform);
}​

The output looks like this (captured in console.debug):

["text","text","text","text","text"]
["text","text","text","text","text"]

The sample should be:

{ "aaData": [
  [ 10126, 10002253, 415 ]
]}
  • 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-15T15:44:59+00:00Added an answer on June 15, 2026 at 3:44 pm

    Use Array.push. And make use of the var statement, you are creating a hell of global variables.

    var aaData = [];
    $.each(jMtbl, function (i, item) {
      aaData.push([
        item.OrigOwner,
        item.PublicationTblNm,
        item.TableId,
        item.MigrationFreq,
        item.GTYPE
      ]);
    });
    

    oTable = $('#dtManaged').dataTable({
      ...
      "aaData": aaData,
      ...
    });
    

    (Note: the links are not only for show, please read through them.)

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

Sidebar

Related Questions

I want to nest an array inside another array, my code will be similar
I need to link the Abaqus ODB C++ API static library in another static
Need help, function getFamily() { FB.api('/me/family', function(response) { alert(JSON.stringify(response)); }); } With the above
I need assistance with overlaying one individual div over another individual div . My
I need a script, preferably jquery, to do the follwoing: I HAVE FOUR LITTLE
Objective: Be able to nest a resource, like records inside of users so that
Is it possible to nest a singleton class inside a non-singleton class in C#,
I have such problem: I don't need to nest all resources, because I need
I need to create a UIButton programatically and then put it on a created
I'm looking to nest two conditionals within another conditional (if that makes sense) of

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.