Currently I am using this to write output in single partition.
df.coalesce(1).write
.format("json")
.mode("overwrite")
.option("path",writePath)
.save
Ouput file is currently in this format :
{obj1} {obj2}
I want this as an array of json object. [{obj1}, {obj2}]