I have a JSON as below
{"uniqueTranId":"12345", "age":25, "name":"Maichael"},
{"uniqueTranId":"67891", "age":30,"name":"Andy"},
{"uniqueTranId":"54326", "age":19, "name":"Justin" }
From the Json I have a DataFrame as
+----+--------+------------+
| age| name|uniqueTranId|
+----+--------+------------+
| 25|Maichael| 12345|
| 30| Andy| 67891|
| 19| Justin| 54326|
+----+--------+------------+
I would like to convert this DataFrame as below.
List(
("12345"), Map["SomeConstant", Array[(uniqueTranId -> 12345, age -> 25, name -> Maichael)]] ,
("67891"), Map["SomeConstant", Array[(uniqueTranId -> 67891, age -> 30, name -> Andy)]],
("54326"), Map["SomeConstant", Array[(uniqueTranId -> 67891, age -> 19, name -> Justin)]]
)
The following is the Type I am looking for.
List([uniqueTranId, Map["SomeConstant", Array[(json_key -> json_value)]])])
Any immediate help is very much appreciated.