Command to build dict.json: cat dictionary.txt | grep -v '^..\?$' | perl -0777 -p -e's/\n/","/mg' | sed -e 's/^,\?/["/' -e 's/,"$/]/' > dict.json (relies on there being a newline at the end)