root
|-- code: string (nullable = true)
|-- mnemonic: string (nullable = true)
|-- key: long (nullable = true)
|-- country: string (nullable = true)
|-- crossID: struct (nullable = false)
| |-- codeKey: long (nullable = true)
| |-- codeGroupCode: string (nullable = true)
| |-- description: string (nullable = true)
| |-- externalCode: string (nullable = true)
|-- ITEM: struct (nullable = false)
| |-- type: string (nullable = true)
| |-- indicator: string (nullable = true)
| |-- imageIndicator: string (nullable = true)
| |-- col20: struct (nullable = false)
| | |-- cCode: string (nullable = true)
| | |-- vCode: string (nullable = true)
The above is the schema of my dataframe. Here I would like group the crossID and its elements as list of maps. Please help me how to do it in java spark.