I'm trying to get JSON raw response from R
Plumber
and consume it in Angular
, but JavaScript Framework
thinks it's a string rather than a JSON format.
"[{\"id\":1,\"type\":\"Diagnostic\"},{\"id\":2,\"type\":\"Impact\"}]"
I saw here and here, but these didn't really help me.
How do I make it so that it's a proper JSON format that JavaScript frameworks can recognize.
#* @apiTitle Diagnostic Report API
#* Send the list of report types
#* @get /reportTypes
#* @serializer unboxedJSON
function(){
reportTypes <- read_csv(file = "ReportTypes.csv")
# list(
# message_echo = paste("The text is:", "text")
# )
}
And in the Angular, this is the error that I receive. Given that this is not Angular SO, I just wanted to show the issue I'm running into:
Cannot find a differ supporting object '[{"id":1,"type":"Diagnostic"},{"id":2,"type":"Impact"}]' of type 'string'. NgFor only supports binding to Iterables such as Arrays.