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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:14:10+00:00 2026-05-29T15:14:10+00:00

I’ve got a CFC thats returning a query object in JSON format, looks like

  • 0

I’ve got a CFC thats returning a query object in JSON format, looks like this:

{
 "COLUMNS":["CMADDR","CMBILL","CMCRLIMIT","CMCRREVIEW","CMCRTERMS","CMCRUPDATE","CMCURR"],
 "DATA":[[1.2004856E7,3.2004856E7,0,"January, 01 1959 00:00:00","N\/30",null,"USD",null,false,false,false,"",0,"","US", ...],
        [2.2045505E7,3.2004583E7,4000,"January, 01 1959 00:00:00","1\/10N30",null,"USD",null,false,false....]]
}

data has been shortened just for structure sake

But I am given back a jSON object with columns & data.

What is the best way to access this data using jQuery? Excuse my inexperience, as in the past I’ve just used more simple structures, and I’ve usually defined them myself, this way the CFC returns this output to me and I’m forced to consume it and iterate through it with end result being a table of data.

I’ve tried the following, but get undefined values so far:

// ajax calls .. this is on success..
// ...
function(data) {
    //alert('got data back! \n'+data);
    var obj = jQuery.parseJSON(data);
    $.each(obj, function(index, itemData) {
    $('#modal-table-listing > tbody:last').append('<tr>' +
        '<td>[Select]</td>' +
        '<td>'+ itemData.cmAddr +'</td>' +
        '<td>'+ itemData.adName +'</td>' +
        '<td>'+ itemData.adState +' - '+ itemData.adCity +' - '+ itemData.adZip +'</td></tr>');
    });

    console.log(obj);
}

I’d love to use the columns object to reference the relevant data, if that makes sense.

  • 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-29T15:14:10+00:00Added an answer on May 29, 2026 at 3:14 pm

    Given your data structure, you really want to be looping through obj.data. Your returned object has TWO properties. One describes your columns, the next is an array of results.

    var obj = jQuery.parseJSON(data);
    $.each(obj.DATA, function(index, itemData) {
    $('tbody:last').append('<tr>' +
        '<td>[Select]</td>' +
        '<td>'+ itemData[0]+'</td>' +
        '<td>'+ itemData[1] +'</td>' +
        '<td>'+ itemData[2] +' - '+ itemData[3] +' - '+ itemData[4] +'</td></tr>');
    });
    

    I don’t know what columns are which index, given the data. But you can figure it out via obj.columns.indexOf('CMADDR'); or something like that, that will give you 0.

    Edit
    You could probably easily write a quick map reduce with Underscore.js to get exactly the format you wanted. Something like

    myData = _.map(obj.data, function(row){ 
                 var item = {"column1" : row[0],
                             "column2" : row[1]}; 
                  return item;
                 }); `
    

    This would result in myData being an array of objects with named properties.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
i got an object with contents of html markup in it, for example: string
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string
this is what i have right now Drawing an RSS feed into the php,
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.