Rename #to_file -> #to_json

You're not converting it to a file, you're converting it to JSON in order to write it to a file.