0

I have json data that I'm importing to R and then exporting in the exact same format. The original code looks like:

"Entries":{"":11.8988438}

Using names<-(""), I can reproduce the double quotes in R, but when writing with write_json(x), I've only come up with:

"Entries":{11.8988438} or "Entries":{"1":11.8988438} or

I've tried manipulating the print options, and no luck so far. I'd be grateful for any other ideas.

Thanks!

Spacedman
  • 92,590
  • 12
  • 140
  • 224
Kyouma
  • 320
  • 6
  • 14

1 Answers1

0

Here's a complete JSON file for testing:

{"Entries":{"":11.8988438}}

If I read and write using package:rjson I get empty-named entities:

> r = rjson::fromJSON(file="./foo.json")
> r
$Entries
$Entries[[1]]
[1] 11.89884


> rjson::toJSON(r)
[1] "{\"Entries\":{\"\":11.8988438}}"

So use the rjson package?

Spacedman
  • 92,590
  • 12
  • 140
  • 224