import os
import json
import csv

dir_name = "/Users/Selva/Downloads/validations/"

for filename in os.listdir(dir_name):
    full_name = os.path.join(dir_name, filename)
    print full_name
    with open(full_name) as json_data:
        d = json.load(json_data)
        for observation in d["observations"]:
            #print(observation["trigger"])
            mylist = [filename, observation["trigger"]]
            with open('/Users/Selva/Downloads/validations/my_csv.csv', 'a') as myfile:
                wr = csv.writer(myfile, quoting=csv.QUOTE_ALL)
                wr.writerow(mylist)
