R - JSON with strings and integers

208 views Asked by At

How do I override that all items in JSON are converted to string?

When I run

require("RJSONIO")
toJSON(structure(c("nonce", as.integer(5487)), names = c("nonce", "price"), class = c("character", "integer")))

I would expect this

"{\n \"nonce\": \"nonce\",\n\"price\": \5487\ \n}"

but I'm getting this

"{\n \"nonce\": \"nonce\",\n\"price\": \"5487\" \n}"

so the price = 5487 is still as string.

0

There are 0 answers