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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:56:51+00:00 2026-06-03T22:56:51+00:00

I have a json which is return from the java code. I use toJSON

  • 0

I have a json which is return from the java code. I use toJSON to show the json but it does’nt showing anything and giving an error when i de-bugged it using firebug.Below is the response which i have to show in browser.

{"status":"0","Response":{ 
        "name":"abc";
    "gender":"male";
    }
}      

below is the function in jsp which i am calling:

$.ajax({
        type: 'post',
        url:$("#abc").val(), 
        dataType:'json',
        success:function(data) {
            alert(data);
           var json = $.toJSON(data);
           alert(json);
           $("#response").val(json);
        },
        error:function() {
             alert("request failed");
        }                 
    });

1st alert shows [object] but 2nd alert is not showing anything.

  • 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-03T22:56:53+00:00Added an answer on June 3, 2026 at 10:56 pm

    There is no such thing as $.toJSON(), thats why you get an error. Use JSON.stringify() and JSON.parse().

    Alternatively, if you set the correct contentType, you should be able to use it without any conversions.

    edit: to be correct toJSON() is a plugin. Imo there is no need for this, the standard JSON-handling from the browsers and jQuery is sufficient for that task.

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

Sidebar

Related Questions

I have a JSON which I get from web application. I try this parse
I have the following C# helper class which retrieves a Json String from a
I have a JSON object which is generated from my website, however I need
I'm trying to return a List from jersey, which works fine in XML, but
When the time return from ajax, I should return as json encode, and use
I have the following code which sometimes return as true and sometimes doesn't. Any
i have a php function which returns a random json encoded color <?php function
I have an external resource similar to https://www.googleapis.com/freebase/v1/text/en/bob_dylan which returns a JSON. I want
I have a method which requests external webservices and returns json here: public string
I have this JSON (which validates according to JSONLint ): [ { "BugCount":"2", "BugTitle":"C:\\INETPUB\\WWWROOT\\CLUBREADY2\\TRAINERS\\../Connections/LTC.asp",

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.