Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
flatten json using flatten_json
#!/usr/bin/env python3
import flatten_json
import sys
import json
if __name__ == '__main__':
if len(sys.argv) < 3:
print(f'usage: {sys.argv[0]} in.csv out.csv')
f_out = open(sys.argv[2], 'w')
for line in open(sys.argv[1]):
j2 = flatten_json.flatten_json(json.loads(line))
f_out.write(json.dumps(j2))
f_out.write("\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.