Dataframe to JSON (Spark / Scala )

Need one help in below error

I am trying to convert below Data frame to Json

Expected Output :

{"source:“abc”,“id”:“123”,“more_detail” :

[{“mid”:10,“date”:11090900000,“type”:abc},{“mid”:11,“date”:11230900000,“type”:jkl},{“mid”:13,“date”:1107878000,“type”:kiu}]}

What I tried :

def func1( records :Dataframe) :Unit =

{

records.show()

records.select (to_json(struct(col(“mid”),col(date),col(type))).show(truncate(false)

val df = records.select(lit(abc).alias(“source”),

lit(“123”).alias(“id”)

collect_list(to_json(struct(col(“mid”),col(date),col(type))).alias("more_details))

val m = df.to JSON

println(m.collect().mkstring(" , "))

What Output I am getting :

{"source:“abc”,“id”:“123”,“more_detail” :

["{ ** “mid ** “:“10”,“date”:“11090900000”,“type”:“abc”}”,”{ ** “mid ** “:“11”,“date”:“11230900000”,“type”:“jkl”}”,”{ ** "mid ** “:“13”,“date”:“1107878000”,“type”:“kiu”}”]}

Please advise so that I can get expected output