I'm trying to extract information from a JSON file and write some of the contents to a CSV file.
Here is an example of my text
"data":{"headers":{"sender":"[email protected]"
"to":"[email protected]"
"subject":"Help with this project"
"x-received-time":"14144273245408"
"received":"from abc.com ()\r\n by mail.mail.com with SMTP (Postfix)\r\n for [email protected];\r\n Mon
"from":"\"Help with this project\" <[email protected]>"
"date":"Mon, 27 Oct 2014 09:03:14 -0500"
"id":"1414427328-2345855-frank"
"to":"[email protected]"
"time":14144273245408
"subject":"Help with this project"
"fromfull":"[email protected]"
I want to grab the contents from: to, fromfull, id, subject, date and write it to a csv file where To is column A, fromfull is column B, and so forth.
Can anyone offer any assistance? This is a JSON response.
jq '. | @csv' myfile.json
.