I have API output in the below format.
reponse.text
'{"position": {"lat": 1.352083, "lon": 103.819836}, "mapView": {"N": 1.4784001, "E": 104.0945001, "S": 1.1496, "W": 103.594}}\n'
I want to convert this output to pandas dataframe .
My code
import json
d = json.loads(response.text)
df = pd.DataFrame(d)
Current Output
position mapView
E NaN 104.0945
N NaN 1.4784
S NaN 1.1496
W NaN 103.5940
lat 1.352083 NaN
lon 103.819836 NaN
My Expected Output
lat lon
1.352083 103.819836
How can this be achieved in python?
