Question: how to convert csv into json in python?
Answer: file = open("sample.csv", "r") dict_reader = csv. DictReader(file) dict_from_csv = list(dict_reader)[0] json_from_csv = json. dumps(dict_from_csv) print(json_from_csv)