Questions tagged [jsonlite]

A smarter JSON encoder and decoder

This package is a fork of RJSONIO by Duncan Temple Lang and builds on the same parser, but uses a different mapping between R objects and JSON data. More details can be found at http://cran.r-project.org/web/packages/jsonlite/index.html

A fast JSON parser and generator optimized for statistical data and the web. Started out as a fork of RJSONIO, but has been completely rewritten in recent versions. The package offers flexible, robust, high performance tools for working with JSON in R and is particularly powerful for building pipelines and interacting with web APIs.

The implementation is based on the mapping described in the vignette of the package (Ooms, 2014). In addition to drop-in replacements for toJSON and fromJSON, jsonlite contains functions to stream, validate, and prettify JSON data.

Reference manual: jsonlite.pdf Vignettes:

419 questions
3
votes
0 answers

Jsonlite: Error: parse error: premature EOF

I am trying to read this data into R with Jsonlite: "{\"Transaction\":…
Soren
  • 43
  • 4
3
votes
3 answers

R to hierarchical JSON using JSONLITE?

My end game is to create a tree visualization from a hierarchical JSON file using D3js. The hierarchy I need to represent is this diagram, where A has children B,C,D ; B has children E,F,G; C has children H, I ; and D has no children. The nodes…
Tim
  • 739
  • 8
  • 26
3
votes
2 answers

Issue scraping data from stats.nba.com

I've been having a bit of trouble scraping data from the stats.nba site. I've done this a few times so not sure what's changed up, but wanted to see if anyone else was having the same problem. I usually just use jsonlite with the request url like…
intern
  • 195
  • 1
  • 1
  • 12
3
votes
1 answer

adding quotes to json in R

I want to scrape the website: link I use GET from httr, and get the json lite object, but without quotes, like below: "hxbase_json1({sum:3003,list:[{Number:'1'... So jsonlite::fromJSON cannot read this json.. My code is url <-…
rankthefirst
  • 1,122
  • 2
  • 11
  • 22
3
votes
0 answers

How to handle HTTP error 503 when making API calls to process JSON files in R with the jsonlite package?

I'm having problems using the JSONlite package in R to collect Dota2 match data using the Steam API. I am not an experienced developer and really appreciate any help. Thanks! I have created a script in R. When I check the API call using a web…
djnikkei
  • 31
  • 1
3
votes
2 answers

Parsing JSONP files using R

JSON newbie here. Could you please help with parsing JSON files using R. I did try jsonlite & rjson, but keep getting errors. Below is the data retrieved via the api. data <-…
J1975
  • 79
  • 5
3
votes
1 answer

Converting JSON file to data.frame

I'm having a heck of a time trying to convert a JSON file to a data frame. I have searched and tried to use others' code to my example but none seem to fit. The output is always still a list instead of a data frame. library(jsonlite) URL <-…
David Gold
  • 59
  • 3
3
votes
0 answers

R - Reading from a list of apis

I'm doing a small task that requires the usage of GitHub's APIs. Most of the data can be retrieved from the main API, but some specific information is an API itself. Here's how the main API is read by R, using jsonlite package: The next task is to…
Gustavo Silva
  • 159
  • 1
  • 10
3
votes
2 answers

How to load online JSON data to shiny app with jsonlite?

I am trying to make shiny app that takes data from this api: https://www.riigiteenused.ee/api/et/all. I need to use jsonlite::fromJSON, because it has good flatten function. When I use the following code (minimal example, in real life I do more…
Risto Hinno
  • 41
  • 1
  • 5
3
votes
1 answer

SSL connect error in R jsonlite package

I am trying to load data from website that are in JSON format so I am using jsonlite R package and fromJSON function. I receive an error as below library(jsonlite) fromJSON(URL) -> x Error in open.connection(con, "rb") : SSL connect error Does…
Marcin Kosiński
  • 7,171
  • 5
  • 45
  • 92
3
votes
0 answers

Convert json object to dataframe- character '0' is not recognized

I am trying to convert this json object to a data frame. I am getting an error that character '0' is not recognized. Any suggestion on how to handle this error occurring in a large json file having 1000 records? library(RJSONIO) json_file<- '{…
user3570187
  • 1,525
  • 1
  • 15
  • 29
3
votes
1 answer

Opencpu simple function json parsing not working

Hi I want to have a simple function for my local opencpu development server. getLinearInterpolatedEstimateQuantil <- function(x, type, probs){ result = quantile(data, type, probs) result #print for simpler debug } Example Debug input would be…
Georg Heiler
  • 13,862
  • 21
  • 115
  • 217
3
votes
1 answer

OpenCPU: No method asJSON S3 class

I am trying to get the JSON representation of the following resource: POST http://myserver/ocpu/library/stats/R/smooth.spline/json The error I get is No method asJSON S3 class: smooth.spline. The result of a smooth.spline() call has the following…
Maurizio
  • 517
  • 5
  • 13
3
votes
3 answers

How to flatten nested data frames returned from jsonlite

I am loading this JSON data with jsonlite "rawData": { "fortune": {}, "plaintext": {}, "db": {}, "update": { "duda": [ { "latencyAvg": "201.40us", "latencyMax": "727.00us", …
Hamy
  • 18,134
  • 13
  • 65
  • 94
3
votes
2 answers

Array in body for httr POST request

This curl call works to create a new droplet on Digital Ocean curl -X POST "https://api.digitalocean.com/v2/droplets" \ -d '{"name":"test3","region":"nyc2","size":"512mb","image":5562742,"ssh_keys":[89103]}' \ -H "Authorization: Bearer $TOKEN"…
sckott
  • 5,252
  • 2
  • 22
  • 40
1 2
3
27 28