I am fetching JSON from API, here is an example of returned JSON:
dct = {
"error": [],
"result": {
"open": {
"OECXRU-DHI22-OOCVY7": {
"refid": None,
"userref": 0,
"status": "open",
"opentm": 1627129746.1643,
"starttm": 0,
"expiretm": 0,
"descr": {
"pair": "STORJUSD",
"type": "sell",
"ordertype": "stop-loss",
"price": "0.79000",
"price2": "0",
"leverage": "none",
"order": "sell 63.72307378 STORJUSD @ stop loss 0.79000",
"close": "",
},
"vol": "63.72307378",
"vol_exec": "0.00000000",
"cost": "0.000000",
"fee": "0.000000",
"price": "0.000000",
"stopprice": "0.000000",
"limitprice": "0.000000",
"misc": "",
"oflags": "fciq",
}
}
},
}
I wish to query dataframe based on key pair and return the transaction ID i.e. return OECXRU-DHI22-OOCVY7 when queried STORJUSD.
I have tried various methods: json_normalize(), DataFrame.from_dict(), DataFrame.from_records()
But I am getting all different kinds of errors in each of these methods.