Skip to content

Instantly share code, notes, and snippets.

@nagpal
Created February 26, 2013 11:09
Show Gist options
  • Select an option

  • Save nagpal/5037724 to your computer and use it in GitHub Desktop.

Select an option

Save nagpal/5037724 to your computer and use it in GitHub Desktop.
JSON to CSV - for importing in excel.
cat filename.json | sed -e 's/{/\n/g' | sed -e 's/}//g' | sed -e 's/\"//g' | awk 'BEGIN {FS=","} {for (i=1; i<=NF; i++) printf("%s,",substr($i,index($i,":")+1)); printf("\n"); }' | sed -e 's/[,]*$//g' > filename.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment