Skip to content

Instantly share code, notes, and snippets.

@ctavan
Created September 28, 2012 14:21
Show Gist options
  • Save ctavan/3800152 to your computer and use it in GitHub Desktop.
Save ctavan/3800152 to your computer and use it in GitHub Desktop.
Convert list of strings to valid JSON array for loading in node.js
cat list.txt | sed 's/\(.*\)/"\1",/;1s/^/[/;$s/.$/]/' > list.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment