-1

I have the following dataset:

+------+-----------+-------+----------+
|userID|   A       |B      |  C       |
+------+-----------+-------+----------+
|1     |242.0      |NULL   |7         |
|2     |NULL       |3.0    |5.0       |
|3     |NULL       |70.0   |17.0      |

I want to transform it into the following json format:

"result":
[
{"userID": 1, "A": 242.0, "B": NULL, "C": 7 }, 
{"userID": 2, "A": NULL, "B": 3.0, "C": 5.0 }, 
{"userID": 3, "A": NULL, "B": 70.0, "C": 17.0 }, 
]

I appreciate help with that.

ronshi
  • 1
  • 1

1 Answers1

0

myDataset.write.json("/tmp/my_dir/")

Elior Malul
  • 683
  • 6
  • 8