I am trying to encode R lists into json using the jsonlite package and the toJSON function. I have a simple item like:
list(op='abc')
I'd like that to become:
{
"op" : "abc"
}
Instead, I get:
{
"op" : ["abc"]
}
The API to which I am trying to feed this json chokes on the latter and requires the former. Any suggestions on how to get the former behavior from jsonlite (or another R json package)?
rjson
package. It is giving the former. – Isoclinerjson
has problems when saving to JSON file with diacritic characters. – Scrubby