Unix Wordlist in JSON

I was looking into writing something that needs to look for each word in the English language in JavaScript and ran into the issue of where to get this data. If I was using a scripting language outside the browser this wouldn't have been a problem. I could have simply included the file found on almost every Unix install found at /usr/share/dict/words but in the browser, it isn't viable to use local files.

I uploaded a copy of my local file as a Gist so it can be easily retrieved with a standard AJAX call. Since the file of the format in Unix simply separates the words by a line break, I also transformed the data into a JSON array, so it could be easily parsed. It is a large file (over 16000 lines) and it takes a while to transfer, so I'd only recommend getting the whole list if your script really needs it.

Here's the script I used to convert the file to JSON, for the curious:

import json


with open('/usr/share/dict/words') as infile:
    words = infile.read().splitlines()
    with open('words.json', 'w') as outfile:
        json.dump(words, outfile)