☰
Login
Signup
Home
›
API clients
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Register
Categories
Recent Discussions
Activity
Categories
13.2K
All Categories
0
Incidents
126
Node JS client
36
Go client
765
.Net API client
360
Kite Publisher
532
.Net / VBA / Excel (3rd party)
433
Algorithms and Strategies
964
Java client
1K
API clients
400
PHP client
3.8K
Python client
331
Mobile and Desktop apps
1.3K
Market data (WebSockets)
3.1K
General
In this Discussion
April 2020
dm121
April 2020
tahseen
Parse Json
dm121
April 2020
in
API clients
@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:
parse
json
JS
tahseen
April 2020
@dm121
I think you should use response.json()
dm121
April 2020
Got this working. There was a bug in the code in forming the URL. Thanks for the reply.
Sign In
or
Register
to comment.
I think you should use response.json()