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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:47:11+00:00 2026-05-29T10:47:11+00:00

EDIT : I’ve gotten the famous question badge with this question, so I figured

  • 0

EDIT: I’ve gotten the “famous question” badge with this question, so I figured I’d come back to it and stick what happened to me right at the very tippy top for people searching it to get an answer right away.

Basically, I was new to JSON. JSON is an object (obviously), as it contains all kinds of stuff! So I was like “Hey, javascript, just pop up an alert with all of this JSON data”, expecting it to give me the JSON data as a string. But javascript doesn’t do that (which is good!), so it was like “Hey, this is how we display objects, [object Object]”.

What I could’ve done is something like alert(obj.DATA[0][1]) and it would’ve shown me that bit of the object.

What I really wanted was to verify that I was making good JSON data, which I could’ve checked with JSON.stringify.

Anyway, back to our regularly scheduled questions!


I’m trying to get some JSON data with an ajax call, but jQuery doesn’t seem to like my JSON.

if I do something like:

function init2() {
    alert("inside init2");
    jQuery.ajax({
        url: "/Mobile_ReportingChain.cfm",
        type: "POST",
        async: false,
        success: function (data) {
            alert(data);
            var obj = jQuery.parseJSON(data);
            alert(obj);
        }
    });
}

I get this as from alert(data):

    {"COLUMNS":["MFIRST_NAME","MLAST_NAME","MMDDL_NAME","MEMPLY_ID","MAIM_NBR","EMPLY_ID"],
    "DATA":[

["FNAME1          ","LNAME1                  ","MI1              ","000-14-7189","026-0010","000-62-7276"]      

,["FNAME2           ","LNAME2                    ","MI2              ","000-01-2302","101-1850","000-14-7189"]  

,["FNAME3           ","LNAME3                  ","MI3              ","000-91-3619","102-1000","000-01-2302"]    

,["FNAME4         ","LNAME4                  ","MI4              ","000-25-9687","102-1000","000-91-3619"]  

]}  

which JSONLint says is valid json. alert(obj) gives me this, however:

[object Object]

adding dataType: "json" or "text json" just makes it report [object Object] at alert(data).

I’d really like to get this figured out, does anyone know why it’s doing this? I’m pretty new at jQuery, my goal is to get an array for each of the columns. The same code I’m using has worked on a different page it looks like, which is what’s bothering me the most.

  • 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-29T10:47:12+00:00Added an answer on May 29, 2026 at 10:47 am

    The alert() function can only display a string of text. As its only parameter it takes a string or an object. The object will however be converted into a string that can be displayed.

    When fetching JSON through jQuery, the $.ajax() method will automatically parse the JSON and turn it into a JavaScript object for you. Your data variable is therefor a JavaScript object, and not a JSON string as one might expect.

    Since alert() only can display strings, when trying to alert your data object, your object will be turned into its string representation. The string representation of a JavaScript object is [object Object].

    For debug-purposes you can use console.log(data) instead. You can then inspect the object and its content through the console in your browsers developer tools.

    function init2() {
        jQuery.ajax({
            url: "/Mobile_ReportingChain.cfm",
            type: "POST",
            dataType: "json",
            async: false,
            success: function (data) {
                console.log(data);
            }
        });
    }
    

    If you for some reason still want to alert the JSON-data, then you would have to turn your data object back into a JSON-string. To do that you can make use of JSON.stringify:

    alert(JSON.stringify(data));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Edit: This question was written in 2008, which was like 3 internet ages ago.
EDIT: This question is more about language engineering than C++ itself. I used C++
Edit: The below question was answered by this . I have a new updated
Edit: I'm looking for solution for this question now also with other programming languages.
EDIT: for those who come here with a similar problem, now i know this
EDIT: This question was exceptionally dumb and made me look like a script kiddie,
EDIT: looking for this: http://diminishing.org/extending-formtastic-with-a-sprinkle-of-jquery (If this works I'll answer my own question) I've
EDIT : Copied wrong part of function into this question, below is the appropriate
Edit: From another question I provided an answer that has links to a lot
EDIT: This was formerly more explicitly titled: - Best solution to stop Kontiki's KHOST.EXE

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.