Questions tagged [rjsonio]

RJSONIO is an R package that allows conversion to and from data in Javascript object notation (JSON) format. This allows R objects to be inserted into Javascript/ActionScript code and allows R programmers to read and convert JSON content to R objects.

RJSONIO is an package that allows conversion to and from data in Javascript object notation () format. This allows R objects to be inserted into / code and allows R programmers to read and convert JSON content to R objects. It is an alternative to the rjson package. The RJSONIO package uses methods, vectorized operations and code and callbacks to R functions for deserializing JSON objects to R. It allows fast parsing of large JSON documents.

The primary functions in the package are

  • fromJSON
  • toJSON
  • asJSVars

The package is extensible, allowing others to define S4 methods for toJSON for different R classes/types. Similarly, the fromJSON function allows the caller to specify a different callback handler which is invoked each time an element (e.g. number, string, key, start or end of an array or object) is found in the JSON content.

Repositories

Other resources

Related tags

83 questions
0
votes
1 answer

do.call(rbind, ... ) exhibits unexpected behaviour inside a loop

I'm trying to download some data and have the following library(RJSONIO) first.day <- as.Date(paste0("202201","01"), "%Y%m%d") today <- Sys.Date() months <- format(seq(first.day, today,by="month"), "%Y%m") length(months) months.df.list <-…
Illimar Rekand
  • 133
  • 1
  • 15
0
votes
1 answer

Convert object from JSON to dataframe quickly

I have an object which is available through a URL in JSON format, and part of it I want to put into a dataframe format to analyse the data in R. I currently do this as follows: # Read data in using fromJSON function data <-…
user1165199
  • 6,351
  • 13
  • 44
  • 60
0
votes
1 answer

Loop Stops when API returns NULL in R

I am looping through an API to match strings and standardize data as per my own reference data-set. In most cases, the API gives a response and the results are populated in an output file. However, when the API returns a NULL the loop stops and I…
marine8115
  • 588
  • 3
  • 22
0
votes
1 answer

Is there a restriction on the no. of HERE API Calls I can make in a loop (using R)

I am trying to loop through a list of origin destination lat long locations to get the transit time. I am getting the following error when I loop. However when I do a single call (without looping), I get an output without error. I use the freemium…
0
votes
1 answer

R: lexical error: invalid char in json text

I am converting from python to R and this is my first attempt at Parsing Json. I have tried jsonlite, RJSONIO, and rjson. All of them stop at the getlabskaters <- fromJSON(getlabskatersRaw). To explain this script a little bit, because I clearly…
Mike.J
  • 117
  • 1
  • 10
0
votes
1 answer

Convert json file to dataframe using RJSONIO package R

I am new to R facing issue in converting json file to dataframe. I have the json file which looks like below: json_file = '[{"id": "abc", "model": "honda", "date": "20190604", "cols": {"action": 15, "values": 18, "not": 29}}, {"id": "abc",…
user15051990
  • 1,835
  • 2
  • 28
  • 42
0
votes
0 answers

Creating Attribute:Value Pairs in JSON Format

I am basically trying to replicate the following json structure with jsonlite (any other package like rson would also be fine if it works better). { "classes": [1, 2, 3], "ID": 0, "Name": "Peter", "Address": "" } My approach so far:…
vanao veneri
  • 970
  • 2
  • 12
  • 31
0
votes
1 answer

Unable to load multilevel JSON into data frame using R

I am unable to load this nested JSON into a data frame. require(RJSONIO) sample_json2 <- '[{ "_id" : { "$oid" : "50b59cd75bed76f46522c34e" }, "student_id" : 0, "class_id" : 2, "scores" : [ { "type" : "exam", "score" : 57.92947112575566 }, {…
0
votes
0 answers

Rjsonio vs jsonlite lexical error

New to this so please excuse any mistakes. I am using R to convert some JSON files and using JSONLITE is perfect in relation to the format that it produces. However I keep getting a lexical error similar to the below Error in parse_con(txt,…
0
votes
1 answer

Parse list of JSON URLs through fromjson

I have a table of urls that each point to a certain json output. I would like to parse them through fromJSON (or any other json parser), in order to extract data from these json outputs, and combine it together in a list of lists. My code is set up…
RobertHaa
  • 79
  • 2
  • 10
0
votes
0 answers

How to force RJSONIO::fromJSON to read numbers as characters?

I have a Json that contains data such as "id" : "165436382098949", but when I try to parse the string using fromJSON, I get something as $data[[1]]$id [1] 1.654364e+14 Which is a nuisance since I need the exact id to perform requests. How can I…
0
votes
1 answer

R data.table Efficiently parsing json data from API call

I am trying to download some data using API call, but I am sure the code can be optimized to a great extent. As of now I have make just 47 such calls, but in future this could go up to 20000 calls. Here is the code. Edit: Since the link is not…
Gaurav Singhal
  • 998
  • 2
  • 10
  • 25
0
votes
0 answers

Struggling to import NZ companies extract into R (json)

The NZ companies register offers a json file containing all publicly available business info. This file comes in at a whopping 40gb, but there is also a smaller json file (~250mb) containing data on unincorporated entities (sole traders etc). As a…
0
votes
0 answers

Accessing only second sub-element from json object in r

This is a sample rows from json object. row1) {"results":[{"address_components":[{"long_name":"16","short_name":"16","types":["street_number"]},{"long_name":"Bhagwan Tatyasaheb Kawade Road","short_name":"BT Kawde…
Andre_k
  • 1,680
  • 3
  • 18
  • 41
0
votes
2 answers

Extracting JSON data from Google geocoding API in R

I'm quite new to Json data structure and so unable to extract data from it. This is the sample rows from Json data which is stored in csv file row1) …
Andre_k
  • 1,680
  • 3
  • 18
  • 41