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

81 questions
20
votes
3 answers

Simplifying a POSIX node with RJSONIO::fromJSON()

I have the following vector of double values, x, where each element represents a POSIX date-time x <- c(1417621083, 1417621204, 1417621384, 1417621564, 1417621623) I am using the RJSONIO package, and would like to continue to do so. As an exercise,…
Rich Scriven
  • 90,041
  • 10
  • 148
  • 213
17
votes
2 answers

RJSONIO vs rjson - better tuning

UPDATE: The tl;dr is that RJSONIO is no longer the faster of the two options. Rather rjson is now much faster. See the comments for additional confirmation of results I was under the impression that RJSONIO was supposed to be faster tha…
Ricardo Saporta
  • 51,025
  • 13
  • 129
  • 166
13
votes
3 answers

How to get the longitude and latitude coordinates from a city name and country in R?

I have a long list of city names and countries and I would like to plot them on a map. In order to do this I need the longitude and latitude information of each of the cities. My table is called test and has the following structure: Cityname …
Jochem
  • 2,957
  • 3
  • 24
  • 51
6
votes
2 answers

Handling NaN when using fromJSON in R

I'm trying to use the fromJSON function in R to read in a JSON file that was given to me, however this file has NaN in it and I can't read it in properly. This is the error I get: Error in feed_push_parser(buf) : lexical error: invalid char in…
5
votes
2 answers

How to replace "unexpected escaped character" in R

When I try to parse JSON from the character object from a Facebook URL I got "Error in fromJSON(data) : unexpected escaped character '\o' at pos 130". Check this out: library(RCurl) library(rjson) data <-…
4
votes
0 answers

How can I identify where or why a JSON is invalid (RJSONIO)

I'm dealing with a data column that is just massive JSON columns. Each row value is ~50,000 characters. After spending some time trying to fiddle with fromJSON to go from JSON -> dataframe where columns = JSON keys, and getting numerous errors in…
Tyler Wood
  • 1,735
  • 2
  • 15
  • 26
4
votes
1 answer

RCurl JSON data to JIRA REST add issue

I'm trying to POST data to JIRA Project using R and I keep getting: Error Bad Request. At first I thought it must be the JSON format that I created. So I wrote the JSON to file and did a curl command from console (see below) and the POST worked just…
codeBarer
  • 2,312
  • 4
  • 34
  • 64
3
votes
2 answers

Get a business' name with Google Maps API

Inverse to most location querying efforts, I am actually trying to identify a business' name with Google APIs by either its address or Google placeid. e.g., when I search for 1625 Wilshire Blvd, Los Angeles, CA 90017 on googlemaps.com, its results…
bshelt141
  • 1,043
  • 10
  • 21
3
votes
1 answer

R errors in loop: file(con, "r") and open.connection(con, "rb")

I am downloading a series of urls which are JSON files, into a list of list, to be analyzed later. baseurl <- "http://zoeken.kvk.nl/Address.ashx?site=handelsregister&partialfields=&q=010" pages <- list() for(i in 1:99999){ if(i <…
RobertHaa
  • 69
  • 2
  • 9
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
2 answers

Problems reading JSON file in R

I have a JSON file (an export from mongoDB) that I'd like to load into R. The document is about 890 MB in size with roughly 63,000 rows of 12 fields. The fields are numeric, character and date. I'd like to end up with a 63000 x 12 data frame.…
SCallan
  • 612
  • 9
  • 22
3
votes
1 answer

Creating CouchDB design documents from R

I need to create CouchDB design-documents from R, so that others can use my code without learning or switching to CouchDB. This link was very useful for learning how to use CouchDB from R:…
Chris
  • 2,156
  • 1
  • 18
  • 33
3
votes
1 answer

R package with dependency on shiny gives RJSONIO warning

My package CTDesignExplorer uses shiny (and shinyIncubator). When I include Depends: shiny in the DESCRIPTION file, there are warnings upon loading the package in RStudio: Warning in .simpleDuplicateClass(def, prev) : the specification for S3…
Roger
  • 393
  • 3
  • 10
2
votes
2 answers

RJSONIO fromJSON error

I have a problem with the fromJSON function in RJSONIO package in R. I have a json file to read with fromJSON {"indy movies" :[ { "name" : "Raiders of the Lost Ark", "year" : 1981, "actors" : { "Indiana Jones": "Harrison Ford", "Dr. René…
W.david
  • 21
  • 1
2
votes
2 answers

Passing unquoted javascript to Highcharts using toJSON

Using shiny and rCharts to create a dashboard app, I need to pass raw javascript (not a string) to the Highcharts object. Given this list series <- list(data = list(c(0, 0), c(100, 0), c(100, 100)), type = 'polygon', …
1
2 3 4 5 6