added header row to CSV output

this takes the keys from the json input and creates a header row out of them, if they exist.