Skip to content

Instantly share code, notes, and snippets.

@jordanholliday
Last active July 10, 2019 16:14
Show Gist options
  • Save jordanholliday/bfccbff192c9ed77e9933e35621b590d to your computer and use it in GitHub Desktop.
Save jordanholliday/bfccbff192c9ed77e9933e35621b590d to your computer and use it in GitHub Desktop.
Cat text file to json
$ brew install jq
$ var=$(cat filename.txt)
$ jq -n --arg v "$var" '{"foo": $v}' > filename.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment