import csv
import json
def csv_to_json(csv_file_path, json_file_path):
with open(csv_file_path, 'r') as csv_file, open(json_file_path, 'w') as json_file:
reader = csv.DictReader(csv_file)
json_data = [row for row in reader]
json.dump(json_data, json_file, indent=4)
# 使用示例
csv_to_json('/path/to/file.csv', '/path/to/file.json')