'How to get rid of string format in Json output from csv

How to get rid of the string format for the data from the JSON format. for example :

json = [{"data" :"abc", "data1" :{"a" : 1,"b":2}, "data2" :{"c" : 3, "d":4}}]

what I am getting is

{"data" :"abc", "data1" :"{"a" : 1,"b":2}", "data2":"{"c" : 3, "d":4}"}

I dont want this " " in the dictionary for values ("{"a" : 1,"b":2}")

the code I'm using to get the data from the CSV is shown below

df = pd.read_csv('gen.csv')  
data = df.to_dict('records')
print(data)

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source