Is there any way in Python to write JSON text to an Excel file?
Normally I would load JSON response into Pandas dataframe and write the dataframe to Excel:
import pandas
form pandas.io.json import json_normalize
import requests
def df_to_excel(df, filename):
writer = pandas.ExcelWriter(filename)
df.to_excel(writer, 'Sheet1')
writer.save()
response = requests.get(url, params).json()
df = json_normalize(response)
df_to_excel(df, 'Response.xlsx')
But this requires converting JSON text to Python object, thus replacing "
with '
, false
with False
, null
with None
etc, and I don't want that.