It would be nice to seperate this method into two methods. One that generates a json compatible dictionary and the other that writes the file. Then a user can make use of the python dictionary even if they don't need to dump to a json file.