python csv to json code code example
Example 1: python csv string to json
import json
import csv
//string_data is your string in csv format
json.dumps(list(csv.DictReader(string_data.splitlines(), delimiter=",")))
Example 2: convert csv to json python
import pandas as pd
df = pd.read_csv (r'Path where the CSV file is saved\File Name.csv')
df.to_json (r'Path where the new JSON file will be stored\New File Name.json')