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
0
votes
0 answers

Warning message: In curlOptions: Duplicated curl options

I am working on an R script that will fetch posts from twitter. I've noticed that everytime I run below statements: l_get <- GET( l_twitterQuery, config(httpheader = c("Authorization" = l_token))) l_post <- POST( url = l_oAuthUrl …
Andres Alvarado
  • 176
  • 1
  • 11
0
votes
1 answer

How to write a JSON object from R dataframe with grouping

In general I feel there is a need to make JSON objects by folding multiple columns. There is no direct way to do this afaik. Please point it out if there is .. I have data of this from A B C 1 a x 1 a y 1 c z 2 d p 2 f q 2 f r How do I write a…
ajkl
  • 976
  • 1
  • 6
  • 24
0
votes
2 answers

How to append data through for loops

I am trying to recursively collect data through loops. I wrote this command and it works for collecting information from 2 pages. For example, library(jsonlite) data1 <- fromJSON("https://www.example.com/?page=1", flatten = TRUE) data2 <-…
user3570187
  • 1,525
  • 1
  • 15
  • 29
0
votes
0 answers

How to create data frame from nested JSON using R jsonlite

I'm using package "jsonlite" to get a json file and convert it to a dataframe so i can run some analysis on it. The problem is I am getting very few columns (i.e 12 instead of 100) and it's because the missing columns appeared to be nested. The…
P C
  • 9
  • 2
0
votes
1 answer

list() contains one element but it has matrix of string inside, how do I convert this element into matrix?

After converting JSON data into a list using jsonlite, i end up with one of the list looking like following In this case, 10th element contain a list of 9 columns (always fixed) and 2 rows (varies everytime). mat <-…
0
votes
1 answer

jsonlite not unpacking JSON from Postgres appropriately

I am pulling data directly from a Postgres database into R, where one of the columns in the Postgres table contains rows of JSON objects. I am trying to unpack the JSON objects and have them flatten into columns in an R dataframe, but so far, I'm…
Bryan
  • 5,039
  • 9
  • 27
  • 48
-1
votes
1 answer

R function stops running with no visible errors

I've written a custom function to read in a JSON file and extract all of the relevant info that I need, with the goal of running it over all files in a directory. I've created a character vector of all the files and using sapply/lapply, I've been…
scp010
  • 1
-1
votes
1 answer

Getting JSON from WEB API to R - Beginner here

Im trying to get JSON from webapi to R From the following website http://wbes.srldc.in/Report/GetCurrentDayFullScheduleMaxRev?regionid=4&ScheduleDate=31-05-2020 When i try in browser, getting a proper response. However when i try in R using any…
Ansha
  • 1
-1
votes
1 answer

Significant digits when converting to JSON

I have a matrix mat of lat/lon coordinates that are accurate to the 12th decimal place. My objective is transform the matrix into a JSON that keeps those digits intact. > head(mat) [,1] [,2] [1,] -122.6790 45.51459 [2,] -122.6789…
the_darkside
  • 5,688
  • 7
  • 36
  • 83
-1
votes
3 answers

How to access object using index notation

I am trying to make an object using table data var cond = [ { "locality": "Dwarka", "Created ->OFP": "4.73", "OFP -> Picked": "2.16", "Picked - > Delivery": "14.91", "Over_All_TAT": "22.65", "Total_Order": "159" …
Mukesh Kumar Singh
  • 573
  • 1
  • 5
  • 18
-1
votes
1 answer

Constructing request payload in R using rjson/jsonlite

My current code as seen below attempts to construct a request payload (body), but isn't giving me the desired result. library(df2json) library(rjson) y = rjson::fromJSON((df2json::df2json(dataframe))) globalparam = "" req = list( Inputs = list( …
Ritika R
  • 67
  • 1
  • 9
-2
votes
1 answer

R problem, JSON objects in csv file, one per cell:

{"received":1588687345,"guid":"0CA2F400004","eventtype":"sensor","payload":{"time":1588687345,"sensor":[{"type":"temp","unit":"degc","value":20}]}} {"received":1588687346,"guid":"0CA2F400004","eventtype":"sensor","payload":{"time":1588687344,"sensor"…
DAL
  • 21
  • 5
-2
votes
1 answer

R funtion for website table into dataframe

I want to download a table from a database that contains a set of information in a table format The website https://membranome.org/species/1 I tried Rcurl,rlist, rvest and jsonlite but i cannot make it for example jsonlite code a <-…
Katrix_02
  • 83
  • 6
-2
votes
1 answer

Calling HTML/XML data from an API using R

I've been sent a worked example by a friend but unfortunately i'm really struggling with it and can't seem to work out how to pull the information into a dataframe to then manipulate it. I initially thought I would be able to simply parse it using…
Jim White
  • 13
  • 3
1 2 3
27
28