Hubert-Dudek
Databricks MVP

Hi I had similar problem with boolean but with export to different data format.

  • please try to write json directly from dataframe without dict and looping (all needed transformation can be done in dataframe):
df2 = df1.select(df1.Account__r, df1.Product_Master__r)
df2.coalesce(1).write.format('json').save('/path/file_name.json')

My blog: https://databrickster.medium.com/