I am making an httr::GET request and the following is being returned.
Response [https://XXXXXXXXXXXXX/XX/XXXXXXX/icehockey_nhl/scores?
apiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&daysFrom=1&dateFormat=iso]
Date: 2023-02-20 05:59
Status: 200
Content-Type: application/json; charset=utf-8
Size: 3.48 kB
[{"id":"6b40a20e8fa1b2ca0101286a21f0b18b","sport_key":"icehockey_nhl","sport_title"
I then run jsonlite::fromJson and get the following error
Error: Argument 'txt' must be a JSON string, URL or file.
While I have seen a few workarounds I haven't seen an answer as to why the error occurs. As you can can see the response is JSON. I would rather not have to introduce additional steps if the data is in fact JSON. Ideas? Thank you in advance.
Could you use the package RJSONIO as below?
library(RJSONIO)
url='http://ip.jsontest.com/'
data <- fromJSON(url)