You can (and probably should) do `writeFile(str)`. It defaults to 'utf8' which is the required encoding for json.