Hi Praveen S ,
Apologies for delay in response. Unfortunately, it's not possible to create nested JSON if your source schema is not defined and not constant. I tried to check if Column patterns in derived column and aggregate could be helpful , but in your case it wont be since schema is not defined. You need to write your own code in C# or python using custom function to achieve that.
Hope it helps. Please accept the answer if it was helpful. Thanks .