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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:41:45+00:00 2026-05-29T07:41:45+00:00

I am trying to parse a JSON response from a server using javascript/jquery. This

  • 0

I am trying to parse a JSON response from a server using javascript/jquery. This is the string:

{
"status": {
    "http_code": 200
},
"contents": "HTTP/1.1 200 OK\r\nTransfer-Encoding: chunked\r\nDate: Tue, 07 Feb 2012 08:14:38 GMT\r\nServer: localhost\r\n\r\n {\"response\": \"true\"} "
}

I need to get the response value.

Here is what I am trying in the success function of my POST query:

            success: function(data) {
            var objstring = JSON.stringify(data);
            var result = jQuery.parseJSON(JSON.stringify(data));
            alert(objstring);

            var result1 = jQuery.parseJSON(JSON.stringify(result.contents[0]));
            alert(result1.response);

            alert(data.contents[0].response);

But so far nothing I have tried returns the correct result’ I keep getting undefined, however the contents of objstring are correct and contain the JSON string.

  • 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-29T07:41:46+00:00Added an answer on May 29, 2026 at 7:41 am

    Seems like the JSON response itself contains JSON content. Depending on how you call the jQuery.post() method, you’ll either get a string or a JSON object. For the first case, use jQuery.parseJSON() to convert the string to a JSON object:

    data = jQuery.parseJSON(theAboveMentionedJsonAsString);
    

    Next, get everything inside the contents property after the first \r\n\r\n:

    var contentBody = data.contents.split("\r\n\r\n", 2)[1];
    

    Lastly, convert that string to JSON and get the desired value:

    var response = jQuery.parseJSON(contentBody).response;
    // "true"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to parse some JSON coming from an AJAX request using jQuery. Basically,
I'm trying to parse a JSON response with jQuery but it's not working. This
I was trying to parse response data from web server. I am using Xcode
I am trying to parse Json response from This URL . I have used
I am trying to parse the JSON response from Wordnik's API. This is built
I am trying to get send json from my javascript (using jquery post) to
I am trying to parse out data from oodle.com api feed using the JSON.NET
I am trying to parse JSON response from a httpwebrequest fetch and a little
I'm trying to parse a json response data from youtube api but i keep
I am trying to parse JSON in an Adobe Flex app, using http://www.mikechambers.com/blog/2006/03/28/tutorial-using-json-with-flex-2-and-actionscript-3/'>This Tutorial

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.