News for hackers. Stuff that matters.
Re:CSV Challenge by th0br0 on Saturday April 25, 2015 @10:31AM (#9438400)
You forgot the select(.creditcard) - see my comment on the gist - as this one does not filter out null'ed creditcards:

  name=`date +'%Y%m%d'`; 
  echo "name,creditcard" > $name; 
  jq -r '.[] | select(.creditcard) | [.name, .creditcard] | @csv' data.json >> $name
Re:CSV Challenge by nburger on Saturday April 25, 2015 @10:43AM (#9438425)
If we're going for succinctness, you could combine these all together:

(echo '"Name","Credit Card"'; jq -r '.[] | select(.creditcard) | [.name, .creditcard] | @csv' data.json) >> `date +%Y%m%d`.csv

Re:CSV Challenge by vitorbaptistaa on Saturday April 25, 2015 @10:47AM (#9438439)
Nice trick to write the headers, thanks!
Re:CSV Challenge by ekimekim on Saturday April 25, 2015 @11:34PM (#9440449)
I used jq as well, though instead of doing a seperate echo I did this:

    ([{name: "name", creditcard: "creditcard"}] + .)[]
instead of .[]

Another less hacky way would be:

    [["name", "creditcard"]] + map(select(.creditcard) | [.name, .creditcard]) | .[] | @csv
Re:CSV Challenge by vitorbaptistaa on Saturday April 25, 2015 @10:39AM (#9438419)
You're right! I missed that requirement.