I have a dataframe which I want to write it as single json file with a specific name. I tried below
df2 = df1.select(df1.col1,df1.col2)
df2.write.format('json').save('/path/file_name.json') # didnt work, writing in folder 'file_name.json' and files with part-XXX
df2.toJSON().saveAsTextFile('/path/file_name.json') # didnt work, writing in folder 'file_name.json' and files with part-XXX
Appreciate if some one can provide a solution.