I am extracting JSON data from a API and trying to write on Azure container path. I am able to display data correctly in notebook, but when i write JSON most of the values are NULL. Any help on where i am going wrong?
headers = {
"accept" : "application/json",
"Content-Type": "application/json",
"Authorization": "Bearer " + str(token)
}
response_get= requests.get(getURL, headers=headers)
response_final=response_get.json()
print("Type:", type(response_final))
data = json_normalize(response_final)
df = spark.createDataFrame(data)
##df.coalesce(1).write.parquet(stagingpath,mode='overwrite')
df.coalesce(1).write.json(stagingpath,mode='overwrite')