response._bodyText works, but I get undefined when I use response._bodyText.result
4 Answers
First you have to parse that because its in json format. Try
data = JSON.parse(response._bodyText)
data.result
For Reference you can study about JSON
2 Comments
Sai Krishna
Thank you.This works. Why doesn't JSON.parse(response) work?
Rupal
Because response is just a object. So you don't need to parse it. You can simply access it by key like response._bodyText.
What you have inside response._bodyText is a stringified JSON.
To access the keys inside of it. you need to first parse it using JSON.parse
Example: JSON.parse('{ "hello":"world" }')
This will give you an object {hello: 'world'}
In your case you do JSON.parse upon response._bodyText, then you can access it just like a normal object.
JSON.parse(response._bodyText)

response._bodyTextworks? Can you doconsole.log(response._bodyText)? What do you see? (You might have to JSON.stringify it.)_bodyTextproperty. If you ARE using a library then you MUST realize that there is an informal coding convention in js that variables that begin with underscore is to be considered private so users MUST NOT USE_bodyText. Look at the object's prototype in__proto. There must be a method to return the response body. Do not use_bodyText