0

I have a variable like this:

{ "Text" : "
            Name:        Useraafsdf
            available       Usef50d0fc138d9r213123
            loggedout       0 

" } 

and I want to get the value of text. but when I write: console.log(Response.Text); I get "undefined". How can I get the value? although I am taking this Response from here: Response = messageObj.responseText; So Maybe this "Text" is an object and not a json.

3
  • What do you have for console.log(Response); ? Commented Sep 11, 2013 at 3:12
  • I get the whole Object like: Object{status: 4, ...responseText: { "Text" : "..."}} So there is a responseText and inside it there is Text which I want the value. Commented Sep 11, 2013 at 3:16
  • You already asked this question. stackoverflow.com/questions/18727073/… Why are you (again) not posting the entire code? Commented Sep 11, 2013 at 3:29

1 Answer 1

2

messageObj.responseText is a string, you have to parse it.

var Response = JSON.parse(messageObj.responseText);
Sign up to request clarification or add additional context in comments.

1 Comment

After trying I realized that messageObj.responseText is an object. but how can I get the value of an object? So what I want to do is to get the value of Text which is an object

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.