I have a problem with rawToChar() and write_json() where my result is a .json file that includes \n and \ and cannot be viewed in a "pretty" manner using notebook+. In addition I can't unfold or Uncollapse the result.
My working sequence is:
request <- httr::GET(
url = "https://myurl",
httr::content_type("application/json")
)
existing_distribution.json = jsonlite::prettify(rawToChar(request$content))
write_json(existing_distribution.json, "distribution.json"), pretty = TRUE)
When I open distribution.json with notepad+ I get a single line ...
["{\n \"ConfigurationStatus\": \"NOT_DEFINED\",\n \"economicStatus ... blahblah \n}\n"]
Any ideas?