install.packages("jsonlite")
library(jsonlite)
jsondata <- "[[126,5], [156,3], [566,2], [1333,4], [1660,5],
[2126,3], [3126,2], [4126,5], [5126,3], [6126,1], [7126,5], [8000,2], [8007,3],
[8100,3], [8200,4], [8300,5], [8310,4], [8320,5], [8330,1]]"
jsondata <- '[{"rating1": [126,5]}, {"rating2": [156,3]}, {"rating3": [566,2]}]'
if(!(is_valid <- validate(jsondata))){
stop("Invalid JSON was posted: ", attr(is_valid, "err"))
}
obj <- as.list(fromJSON(jsondata));
if(!is.list(obj)|| length(names(obj)) < length(obj)){
stop("JSON or ProtoBuf input should be a named list.")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.