Using shiny and rCharts to create a dashboard app, I need to pass raw javascript (not a string) to the Highcharts object.
Given this list
series <- list(data = list(c(0, 0), c(100, 0), c(100, 100)),
type = 'polygon',
color = 'Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0.5).get()')
I need to generate this JSON
{series:[{
data: [[0, 0], [100, 0], [100, 100]],
type: 'polygon',
color: Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0.5).get()
}]
}
but I can't find any way to prevent RJSONIO or jsonlte from quoting the value of the color property
shiny providers the JS() for wrapping literal javascript but RJSONIO ignores it and jsonlite complains about a missing a asJSON method for class JS_EVAL.
Is there some other way to selective prevent quoting of toJSON output?