Skip to content

Instantly share code, notes, and snippets.

@diyinfosec
Created June 5, 2020 16:10
Show Gist options
  • Save diyinfosec/62de1e11bc4ad18eb5764d9523d5de7f to your computer and use it in GitHub Desktop.
Save diyinfosec/62de1e11bc4ad18eb5764d9523d5de7f to your computer and use it in GitHub Desktop.
Simple csv to json conversion in python. Useful for csv log files that have a header.
import csv
import json
with open('splunk.csv', mode='r') as infile:
reader = csv.DictReader(infile)
for rows in reader:
print(json.dumps(rows))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment