write json r code example Example 1: how to write a json in r write(jsonData, "output.json") Example 2: how to write a json in r jsonData <- toJSON(list1)