how to write a json in r

JavaScript
write(jsonData, "output.json") jsonData <- toJSON(list1)
Source

Also in JavaScript: