We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
jsonlite::read_json
It's nice that jsonlite::read_json supports URLs for paths:
url = "https://github.com/related-sciences/nxontology-data/raw/71cf538dc5c258ada880d58663b0205b7b7f8561/087_chembl_target_tree.json" jsonlite::read_json(path = url)
However, it doesn't appear to support URLs where the data is compressed:
url = "https://github.com/related-sciences/nxontology-data/raw/3330eb4ce4b29eb7399adb4e317a10a1c91138a7/mesh_topical_descriptor_descendants.json.gz" jsonlite::read_json(path = url) # fails
Would be nice to implement similar compression support to readr (docs):
Files ending in .gz, .bz2, .xz, or .zip will be automatically uncompressed.
.gz
.bz2
.xz
.zip
And possibly adding a compression argument like pandas.read_json, such that users can override the inferred compression from the path.
pandas.read_json
The text was updated successfully, but these errors were encountered:
R has built-in compression tools so you can easily write a wrapper yourself.
read_compressed <- function(url){ tmp <- tempfile() curl::curl_download(url, tmp) jsonlite::parse_json(gzfile(tmp)) } url = "https://github.com/related-sciences/nxontology-data/raw/3330eb4ce4b29eb7399adb4e317a10a1c91138a7/mesh_topical_descriptor_descendants.json.gz" read_compressed(url)
This also works:
url = "https://github.com/related-sciences/nxontology-data/raw/3330eb4ce4b29eb7399adb4e317a10a1c91138a7/mesh_topical_descriptor_descendants.json.gz" jsonlite::parse_json(gzcon(url(url)))
Sorry, something went wrong.
@jeroen much appreciate the code to read the gzipped URL data.
Is nice to have jsonlite abstract the compression handling, but understand if that's out of scope for the package.
jsonlite
No branches or pull requests
It's nice that
jsonlite::read_json
supports URLs for paths:However, it doesn't appear to support URLs where the data is compressed:
Would be nice to implement similar compression support to readr (docs):
And possibly adding a compression argument like
pandas.read_json
, such that users can override the inferred compression from the path.The text was updated successfully, but these errors were encountered: