I need to pass JSON object to a function in r programming. The following are the various examples of JavaScript objects that can be passed which needed to be converted to JSON in r
Example1 = [
{name: "Orange", data: {"Tuesday": 3, "Friday": 4}, stack: "fruit"},
{name: "Apple", data: {"Tuesday": 1, "Friday": 8}, stack: "fruit"},
{name: "Cucumber", data: {"Tuesday": 3, "Friday": 4}, stack: "vegetable"},
{name: "Carrot", data: {"Tuesday": 1, "Friday": 8}, stack: "vegetable"}
]
Example2 = [["Washington", "1789-04-29", "1797-03-03"], ["Adams", "1797-03-03", "1801-03-03"]]
I need help converting them into a JSON object in r using jsonlite package.
To have a "true" JSON string, you can use the jsonNormalize package.
The jsonNormalize package also provides a RStudio addin allowing to normalize a json file by pressing a button.