I have below JSON structure in my dataframe as a body attribute. I would like to drop multiple columns/attributes from the content based on provided list, how can I do this in scala ?
Note that the list of attributes is variable in nature.
Let Say,
List of columns to drop : List(alias, firstName, lastName)
Input
"Content":{
"alias":"Jon",
"firstName":"Jonathan",
"lastName":"Mathew",
"displayName":"Jonathan Mathew",
"createdDate":"2021-08-10T13:06:35.866Z",
"updatedDate":"2021-08-10T13:06:35.866Z",
"isDeleted":false,
"address":"xx street",
"phone":"xxx90"
}
Output :
"Content":{
"displayName":"Jonathan Mathew",
"createdDate":"2021-08-10T13:06:35.866Z",
"updatedDate":"2021-08-10T13:06:35.866Z",
"isDeleted":false,
"address":"xx street",
"phone":"xxx90"
}