I have a dataframe whose schema looks like this:
event: struct (nullable = true)
| | event_category: string (nullable = true)
| | event_name: string (n
You can use explode in an array or map columns so you need to convert the properties struct to array and then apply the explode function as below
import org.apache.spark.sql.functions._
df_json.withColumn("event_properties", explode(array($"event.properties.*"))).show(false)
You should have your desired requirement