Advertisement
Ashwini_p

Untitled

May 26th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. import json
  2. import csv
  3. open_jsonfile = open(r"C:\Users\Rohan\Downloads\Python-email\data.json")
  4. json_data = json.load(open_jsonfile)
  5. open_jsonfile.close()
  6. csv_open = csv.writer(open("csv_out.csv", 'wb+'))
  7. for flds in json_data:
  8. field_val = [x.encode('utf8') for x in flds['fields'].values()]
  9. csv_open([flds['id'], flds['name']] + field_val)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement