Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Transform Spark dataframe to nested Json

Transform Spark dataframe to nested Json

New Contributor

Dear all,

I have the following input data that I read in a Spark dataframe. I would like to transform it into a nested Json file (or any other data structure with a key -> values structure) as follows:

  1. Input Data:
ObjectCriteria
AE123
AE456
AE321
AF234
AF311

2- Json File structure:

{

AE:

[123, 456, 321] } ,

{

AF:

[234 , 311] }

}

Thanks in advance

Don't have an account?
Coming from Hortonworks? Activate your account here