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:

509 questions
0
votes
2 answers

First element of JSON in R language

I have the following JSON object: {"42030636":{"String1":"dixit dominus","String2":"la resurrezione","String3":"water music"}} After I ingested it using fromJSON() (Jsonlite). I got the following nested list (let's call it…
0
votes
1 answer

read nested json and convert it to tidy data

I am trying to convert a json to a tibble that follow Tidy Data principles. The website http://pv.servelelecciones.cl/ has some nice regional data. Because I cannot provide a direct link to "Aysen region" as the url doesn't change, this is the data…
pachadotdev
  • 3,345
  • 6
  • 33
  • 60
0
votes
0 answers

Dynamic JSON editing in r

I am using the jsonlite package to work with a complex json file in r. To give a sense of its complexity, here is a look into two different data frames it contains > output$dataobjects[1]$dataobject$scoredresults$x xid rawscore tscore…
ADF
  • 522
  • 6
  • 14
0
votes
1 answer

json query in R using slash

I want to download a dataset from elastic in R. Everything works so far. library(jsonlite) filter <- paste('"', "type: type1", '"', sep = "") q <- paste( '{ "query": { "query_string" : { "query" :…
Lale
  • 1
  • 3
0
votes
1 answer

Edit JSON object

I converted a excel file to a JSON object in R using jsonlite package.I want the whole array as a value to a key and add other some more key value pairs to that object. The JSON array I got after converting the excel file looks like this - [{ …
Aakash
  • 79
  • 6
0
votes
1 answer

Can't use jsonlite in R to read json format file

I can't use R to read the .json file, but I can see it on the web site. Below is the site of…
swchen
  • 643
  • 2
  • 8
  • 24
0
votes
2 answers

Getting error while converting json file to a data frame using jsonlite

I am using the tweetscores package of R to get 'tweets list from twitter. The tweets are stored in json format. While converting it to a data frame I get a lexical error ' Error: lexical error: inside a string, '\' occurs before a character which…
Devarshi Mandal
  • 703
  • 8
  • 16
0
votes
1 answer

R: Unable to generate output in Key value pair from dataframe

I am trying to convert list of data to map data with keys and values. But iam facing the problem to convert it, I have tried with the below code but i is not satisfying to my requirement. I need the data as show in the image below > df <-…
dondapati
  • 829
  • 6
  • 18
0
votes
1 answer

Create multi element json

I have a data frame as follows: item <- c(rep.int("Item ID 1", 4), rep.int("Item ID 2", 3)) links <- c("A", "B", "C", "D", "A", "E", "F") df <- as.data.frame(cbind(item, links)) I am looking to convert this to a json with multiple values for each…
Drj
  • 1,176
  • 1
  • 11
  • 26
0
votes
1 answer

List names as JSON object name

i am facing the problem of JSON object naming in R. df = list(`Choose to and fro flights` = data.frame(sec =c('15:31:36' ,'15:31:37'),label=c("Choose to and fro flights","Choose to and fro flights"),responseCode = c( 200, 200), Counting=c(9,1)), …
dondapati
  • 829
  • 6
  • 18
0
votes
1 answer

Convert JSON dataframe to lines of plain-text json with R

I need to transform a json table to lines of json: To go from: [{"field1": "ABC","field2": "DEF"}, {"field1": "GHI","field2": "JKL"}] To an plain-text file where each line is valid json, like: {"field1": "ABC","field2": "DEF"} {"field1":…
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
1 answer

Extract only the key elements at a specific level from a JSON using R

I am working in R with huge JSON files. These JSON files have lists that are nested into lists that are nested into lists (etc...). So that there are multiple levels of elements. My question is how can I extract only the key elements stored at one…
Isa
  • 53
  • 2
  • 9
0
votes
0 answers

Transform json into table where attributes come columns and objects come rows

I'm running some scripts in version 3.4.1 using Rstudio. What I need ? Transform json into table where attributes come columns and objects come rows That's the script: library(data.table) library(jsonlite) url <-…
0
votes
1 answer

Import multiple JSON files and predict the STATUS using the time series data in R

I am working on pulling multiple JSON files into R My JSON data looks like this (I have only shown 2 samples but there are close to 800 samples) { "ID": 9, "BCOUNT": 800, "MEASUREMENT": [ { "MEAS_ID": 1, "PDATETIME":…
Sharath
  • 2,225
  • 3
  • 24
  • 37