So this example below represents exactly the structure I'm dealing with as it comes from the API
example <- list(
list(message = "konrad semsch",
data = list(
x = 1,
y = 2,
z = 3
)
)
)
which I then subsequently format to:
example <- as.character(example)
[1] "list(message = \"konrad semsch\", data = list(x = 1, y = 2, z = 3))"
When I try to use jsonlite::fromJSON it gives the same error as I have in my original set:
> jsonlite::fromJSON(example)
Error: lexical error: invalid char in json text.
list(message = "konrad semsch",
(right here) ------^
So in this context your latest solution also would fail because the first this entire chunk needs to be parsed into a list format that R understands right?