i have two list, one is column names and another one is data type and i would like to form a json.
sample code:
columnNameList = ["name", "age"]
dataTypeList = ["string", "int"]
colDataList = [{"colName": k, "dataType": v} for k, v in zip(columnNameList, dataTypeList)]
colDataDict = {"schema": colDataList}
print(colDataDict)
The above code gives me the below output, but everything is enclosed with single quotes, why is that? also is this the best way of doing it?
sample output:
{
'schema':[
{
'colName':'name',
'dataType':'string'
},
{
'colName':'age',
'dataType':'int'
}
]
}