How to get ohlc data from this json in python where is intrument key change

{
“status”: “success”,
“data”: {
“NSE_EQ:NHPC”: {
“ohlc”: {
“open”: 53.4,
“high”: 53.8,
“low”: 51.75,
“close”: 52.05
},
“depth”: {
“buy”: [
{
“quantity”: 6917,
“price”: 52.05,
“orders”: 20
},
{
“quantity”: 0,
“price”: 0,
“orders”: 0
},
{
“quantity”: 0,
“price”: 0,
“orders”: 0
},
{
“quantity”: 0,
“price”: 0,
“orders”: 0
},
{
“quantity”: 0,
“price”: 0,
“orders”: 0
}
],
“sell”: [
{
“quantity”: 0,
“price”: 0,
“orders”: 0
},
{
“quantity”: 0,
“price”: 0,
“orders”: 0
},
{
“quantity”: 0,
“price”: 0,
“orders”: 0
},
{
“quantity”: 0,
“price”: 0,
“orders”: 0
},
{
“quantity”: 0,
“price”: 0,
“orders”: 0
}
]
},
“timestamp”: “2023-10-19T05:21:51.099+05:30”,
“instrument_token”: “NSE_EQ|INE848E01016”,
“symbol”: “NHPC”,
“last_price”: 52.04999923706055,
“volume”: 24123697,
“average_price”: 52.56,
“oi”: 0,
“net_change”: -1.0500000000000043,
“total_buy_quantity”: 6917,
“total_sell_quantity”: 0,
“lower_circuit_limit”: 42.5,
“upper_circuit_limit”: 63.7,
“last_trade_time”: “1697624972130”,
“oi_day_high”: 0,
“oi_day_low”: 0
}
}
}

Hi @Arun_Yadav,

You can extract the OHLC data from the provided JSON using the following Python code:
ohlc = json_data["data"]["NSE_EQ:NHPC"]["ohlc"]

This assumes that the json_data variable contains the JSON structure shared in the post.

Thank you!