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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:48:44+00:00 2026-06-04T02:48:44+00:00

This will probably be easy, but I need to access the values in this

  • 0

This will probably be easy, but I need to access the values in this JSON object. I have no idea how. Here’s the object:

{
    "COLUMNS": ["NAME"],
    "DATA":  [["YOUNG, MARIA              "]]
}

I was hoping “obj.NAME” would do it, but it says it’s undefined. Here’s my AJAX call:

$.ajax({
                        //this is the php file that processes the data and send mail
                        url: 'components/Person.cfc',

                        //GET method is used
                        type: "POST",

                        //pass the data        
                        data: {
                            method: "getGroup",
                            uid: $('#cardText').val()
                            },

                        success: function(response) {

                            var obj = $.trim(response);
                            var obj = jQuery.parseJSON(obj);
                            $('#form_result').html(obj.NAME);

                        },
  • 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-04T02:48:46+00:00Added an answer on June 4, 2026 at 2:48 am

    In your code, the following example shows how to access the properties in this particular JSON object:

    alert( obj.COLUMNS[0] );  // alerts the string "NAME".
    
    alert( obj.DATA[0][0] );   // alerts "YOUNG, MARIA              "
    

    To understand why this is the output, it’s important to understand and learn to read the notation that makes up JSON:

    {} = object
    
    [] = array
    

    Your JSON:

    {
        "COLUMNS": ["NAME"],
        "DATA":  [["YOUNG, MARIA              "]]
    }
    

    Since the outermost part is represented by curly braces, we know the JSON represents an object, not an array. The object has two properties, both of which are arrays, since the values assigned to them are wrapped in brackets.

    The second property, DATA, is actually an array of size 1 that contains another array of size 1 that contains a string.

    Finally, in your code, you’re trying to access NAME, which is a value, not a property. JSON the final point to understand about JSON is that all objects are represented by key/value pairs. You use the key to access the value. obj.COLUMNS retrieves the first array, and obj.DATA retrieves the second array.

    NAME is not a property. Instead, it is a value assigned to the array.

    To help you learn how to access the JSON, practice accessing the properties of different objects. Additionally, you can convert existing objects back to JSON and display them in your console so that you can see how they are structured in JSON:

    var your_object = new Object();
    your_object.name = "Bob";
    your_object.skills = ["programmer","debugger","writer"];
    
    console.info( JSON.stringify( your_object ) );
    
    // this would convert the object to JSON. Going the other direction could help 
      // you further understand the concepts under the hood. Here is the output:
    { "name" : "Bob", "skills" : [ "programmer" , "debugger" , "writer" ] }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably easy to do but I have a table which list items
Quick question- I know this is probably really easy, but my excel skills have
This will probably be obvious but I can't find the best way. I want
This will probably be a bot of a waffly question but ill try my
This will probably be just another unsolved thread but i'll fill in some info
This is confusing me, so this question will probably be confusing. I have a
It probably isn't even possible to do this, but I will ask anyway. Is
I suspect there's probably an easy answer to this I'm just not seeing, but
I realize that this is a question that will probably not have a single
Its late and I probably should sleep on this. Easy one I have 3

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.