Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2022 02:12 AM
As Spark can handle nested columns, I would first construct the nested structure in spark (as from spark 3.1.1 there is the excellent column.withField method with which you can create your structure.
Finally write it to json.
That seems to be the easiest way, but your case might be more complex, that is hard to say without some more info.