Questions tagged [rjson]

Converts R object into JSON objects and vice-versa

rjson is an package for woking with , allowing JSON objects to be imported as R objects, and R objects to be serialized as JSON.

Repositories

Vignettes

Other resources

Related tags

135 questions
1
vote
1 answer

Why can't I download from a link in R markdown?

I tried to run this code in a rmd file but still I'm getting an error and I don't know how to resolve this. The Code is: pizza3 <- fromJSON('http://www.jaredlander.com/data/PizzaFavorites.json') And I'm getting an error as: Error in…
1
vote
2 answers

R is very slow reading in .jsonl files

I need to read .jsonl files in to R, and it's going very slowly. For a file that's 67,000 lines, it took over 10 minutes to load. Here's my code: library(dplyr) library(tidyr) library(rjson) f<-data.frame(Reduce(rbind,…
A.Vail
  • 15
  • 2
1
vote
1 answer

How do I convert my walkscoreAPI output list to a dataframe in R?

I have used the walkscore API to generate output for a list of Lat and Longs Reprex of dataset: tibble::tribble( ~Lat, ~Long, 39.75454546, -82.63637088, 40.85117794, -81.47034464, 40.53956136, -74.33630685, 42.16066679,…
user11777262
1
vote
1 answer

Key-value pairs with character data to a dataframe in R?

I had been following this guide for how to convert a key-value dictionary to a dataframe in R using rjson, but I can't seem to get it to work with my data: {"tagid":493,"name":"Early…
AI52487963
  • 1,253
  • 2
  • 17
  • 36
1
vote
2 answers

How to import multiple json objects from a json file into R as a dataframe in such a way that all values are consecutive rows and names are columns

I need it as a dataframe in order to create predictive and classification models on it in R. The json file looks as follows: {"reviewerID": "A2IBPI20UZIR0U", "asin": "1384719342", "reviewerName": "cassandra tu \"Yeah, well, that's just like, u...",…
1
vote
0 answers

Extract only one field from JSON with R

I recently created a function that is calling an API and gives the following results (json format): {"data":{"loc":"google.fr","lang":"fr","domain":"domain.com","result":[["voyage thailande",1,"https://www.blabla.com/thailande/"]]}} My purpose is…
Franck
  • 87
  • 8
1
vote
1 answer

How to loop over JSON array in a JSON object

I've been trying to learn R and I have a JSON file full of single line JSON objects, and each object has an array of account data. What I'm trying to do is parse each row, then get the JSON array out of the parsed JSON object, pull the account type…
CGideon
  • 143
  • 2
  • 15
1
vote
1 answer

forward slashes at the front of JSON data

This is a request for a JSON data file from Statistics Canada; it is the example URL for its new Web Data Service. When I try to get the file via rjson, I get an error about an unexpected character Error in fromJSON(file = census_url) : unexpected…
spindoctor
  • 1,719
  • 1
  • 18
  • 42
1
vote
1 answer

How to convert dictionary data in to dataframe from JSON file in R?

I'm new to the R. And I want to read the JSON file and convert into tabular structure file. Can you please help me how to convert the following data into the tabular structure format. The data is in JSON file as…
David
  • 366
  • 3
  • 22
1
vote
1 answer

R Cannot Open Connection`

I am scraping from the NBA.com API for some shots data. The url that I am using is url =…
Daniel
  • 33
  • 9
1
vote
1 answer

Error in Parsing Json to Dataframe R

I am getting below mentioned error while passing Json dataframe. Error in data.frame(Addr = "London", companyName = "Eagle SUITS", : arguments imply differing number of rows: 1, 0, 2 In addition: Warning message: In data.frame(Addr = "NA",…
Vector JX
  • 179
  • 4
  • 23
1
vote
2 answers

JSON to R data.frame

I have a problem using rjson package to convert JSON to R data.frame. I started with: library("rjson") json_file <- "btcusd.txt" json_data <- fromJSON(paste(readLines(json_file), collapse="")) btcusd.txt file contains the…
professorG
  • 11
  • 2
1
vote
0 answers

Convert SQL Server Data to Json with R

I want to select 2 related tables ( invoice , invoice_detail ) from sql server - and nest the invoice_detail data in each record - outputting in json format ( like the format at the bottom of this page ) using R ( I can't use SQL Server because it…
Martin Thompson
  • 3,415
  • 10
  • 38
  • 62
1
vote
0 answers

Error: result would exceed 2^31 bytes

I am trying to load a JSON file into r using rjson. I get the following error message: Error in paste(readLines(file, warn = FALSE), collapse = "") : result would exceed 2^31-1 bytes My code is as follows: JsonData <- fromJSON(file= "text.txt",…
1
vote
1 answer

R - rjson "Unexpected character: :" (finding the source of the error)

I need to find certain information from a JSON data set that my company acquired. When I try to import it to a variable via the "fromJSON" method, I get the error listed in the title. The data set contains information for over 16,000 files, so…
AlBeast
  • 25
  • 6
1 2 3
8 9