Parse Json

dm121
@sujith

How do I get last_price from this response from quote/ltp?i=NSE:INFY, in Js. I am able to get the same in Python, but struggling in Js.

{"status":"success","data":{"NSE:INFY":{"instrument_token":408065,"last_price":658}}}

I am able to get the data element. It is nested Json.

var jsonText = response.getContentText();
var Json = JSON.parse(jsonText);
var data = Json.data

How to retrieve "last_price" element in JavaScript. Thanks.

//Mohan
Tagged:
Sign In or Register to comment.