SailajaB
Databricks Partner

@Hubert Dudek​ , Thank you for the reply.

We are new to ADB. And using the below code, looking for an optimized way to do it

dfJSONString = df.toJSON().collect()

stringList = []

  for row in dfJSONString:

    # ==== Unflatten the JSON string ==== #

    jsonString = unflatten(json.loads(row),dictreg[reg.upper()])

     stringList.append(json.dumps(jsonString))

Thank you