Nested JSON file

Below is my JSON file, I am reading with the option multi line as true as shown below and I used explode option to flatten the dataframe, But I am not able to flatten the address getting error like Message: cannot resolve ‘explode(s2.address)’ due to data type mismatch: input to function explode should be array or map type, not string; line 1 pos 45;

val std = spark.read.option(“multiline”, “true”).json("/user/viswatejaster9073/JSON/students.json").toDF

val result = spark.sql(“select s.address,s.age,s.class,s.name,s.score from stu lateral view explode(students) t as s”)

{
“students”:[
{
“name”:“Viswa”,
“age”:“10”,
“score”:“100”,
“class”:“1”,
“address”:[
{
“addtype”:“Home”,
“landmark”:“KHT”,
“mobile”:“123”
},
{
“addtype”:“office”,
“landmark”:“KHT”,
“mobile”:“123”
}
]
},
{
“name”:“Teja”,
“age”:“99”,
“score”:“11”,
“class”:“3”,
“address”:{
“addtype”:“Office”,
“landmark”:“KHT”,
“mobile”:“123”
}
},
{
“name”:“Ashok”,
“age”:“11”,
“score”:“111”,
“class”:“21”,
“address”:{
“addtype”:“Office”,
“landmark”:“KHT”,
“mobile”:“123”
}
}
]
}

If you see the below result dataframe read address as a string
image

image