New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with content() for JSON response #330

Closed
loganlinn opened this Issue Feb 1, 2016 · 6 comments

Comments

Projects
None yet
7 participants
@loganlinn

loganlinn commented Feb 1, 2016

I am getting an error with latest httr version when calling content on a JSON response. Here's a small reproduction:

> httr::content(
+   httr::GET("https://status.github.com/api/status.json", encoding="UTF-8"),
+   type = "application/json",
+   simplifyVector = TRUE
+ )
Error in simplify(obj, simplifyVector = simplifyVector, simplifyDataFrame = simplifyDataFrame,  :
  unused argument (encoding = NULL)

The error will actually go away if I don't use simplifyVector argument. But I think the real issue is lies in this change: f0fc278#diff-de09a71ef56d7758b0d08b98fe0520eaL68

The encoding argument was removed from function signature and now gets passed to jsonlite::fromJSON. If I put encoding = NULL back in that signature, ie removing it from ..., I no longer get the error

@s-r-k

This comment has been minimized.

s-r-k commented Feb 29, 2016

I am still receiving this error. Actually I am using another package that internally uses httr. Any workarounds? When can the solution be expected?

@alexdeng

This comment has been minimized.

alexdeng commented Mar 21, 2016

+1. hitted the same issue.

@maju116

This comment has been minimized.

maju116 commented Mar 24, 2016

+1

1 similar comment
@MarcinKosinski

This comment has been minimized.

MarcinKosinski commented Mar 24, 2016

+1

@jeroen

This comment has been minimized.

Member

jeroen commented Mar 24, 2016

This needs to be fixed, but generally it is safer to extract the text and pass it to the parser yourself:

req <- httr::GET("https://status.github.com/api/status.json")
text <- httr::content(req, "text", encoding="UTF-8")
data <- jsonlite::fromJSON(text)
@potockan

This comment has been minimized.

potockan commented Mar 25, 2016

+1

pieterprovoost added a commit to iobis/robis that referenced this issue Apr 15, 2016

@hadley hadley closed this in c9a0dfc May 20, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment