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

How do I read multiple JSON structures contained in one file?

I have a .txt file with this structure section1#[{"p": "0.999834", "tag": "MA"},{"p": "1", "tag": "MO"},...etc...}] section1#[{"p": "0.9995", "tag": "NC"},{"p": "1", "tag": "FL"},...etc...}] ... section2#[{"p": "0.9995", "tag": "NC"},{"p": "1",…
pachadotdev
  • 3,345
  • 6
  • 33
  • 60
0
votes
1 answer

convert json to datatable using rjsonio

I have properly formatted JSON fetched through a standard API. API Basically returns an array of JSON objects each time I fetch data. LIke this: [ {}, {}, {} ] I have used JSON editor to check structure of JSON data and that looks perfect. I…
systemdebt
  • 4,589
  • 10
  • 55
  • 116
0
votes
1 answer

r - jsonlite add carriage returns at end of json array "parent elements"

I am new to manipulating json arrays in R. When I write a json array using R package jsonlite to a .json file using the below code, I get the entire json array printed on the first line of that file (reg is a data.frame). rownames(reg) <-…
lrthistlethwaite
  • 494
  • 2
  • 6
  • 23
0
votes
1 answer

jsonlite's fromJSON is returning a list of 2 lists instead of a df

I'm following the FCC's documentation to download some metadata about proceedings. I don't believe I can post the data but you can get a free API key. My code results in a listed list of 2 lists instead of a structured df from the JSON format. My…
user12279
  • 21
  • 1
  • 4
0
votes
1 answer

How to get fromJSON list to data frame?

I am new to json data and need help in disentangling the data in to a data frame.. The str(url) shows that this is a list containing lists and data frames. I searched the interweb, but found no simple solution to the problem..…
Dr. Flow
  • 456
  • 5
  • 19
0
votes
2 answers

How to parse specific entities in R?

I have JSON file with events and logs inside those events, the example looks like this: { "sessionEvents": [ { "u": "BC0F6A3A2840B6F48386BABC5F34B480BA4F9929", "v": "0.1.0", "dv": "Unidentified", "t": 1462924115818, …
andrew-zmeul
  • 121
  • 1
  • 1
  • 10
0
votes
1 answer

Keep duplicated names in json object from jsonlite conversion of list

How can I convert a list to a json object using jsonlite keeping duplicated names? z<-as.list(letters[1:3]) names(z)<-c("tmp","tmp","tmp") toJSON(z,auto_unbox=TRUE) results in {"tmp":"a","tmp.1":"b","tmp.2":"c"} but I need {"tmp": ["a", "b",…
Iain
  • 1,608
  • 4
  • 22
  • 27
0
votes
1 answer

how do you extract data from nested json data in R

I need to be able to extract these fields from this file that has many json entries: sender: Hostname mem:used_p cpu: user_p load: load_5 // cat…
user1471980
  • 10,127
  • 48
  • 136
  • 235
0
votes
0 answers

Error working with jsonlite R package

I want to read in data from an API to R using jsonlite, but gives me the error message shown below. Before some months, it was working fine. What could be the reason that it is not working now? I am trying to get data from the openFDA API: …
Fisseha Berhane
  • 2,533
  • 4
  • 30
  • 48
0
votes
1 answer

R jsonlite filter records before loading

I have many large json files (3G each) which I want to load efficiently to a strong RServer machine, however loading all record from all files will be redundant and exhausting (50M records multiply by 40). So I thought using jsonlite package because…
Nir Regev
  • 135
  • 1
  • 2
  • 7
0
votes
2 answers

Importing JSON data in R to be saved as dataframe

I am trying to import JSON data from a URL and save it as a dataframe. Once I have it in a single rows/columns format dataframe, I want to perform cleaning operations like removing some values and columns. I am using jsonlite package to…
Fenil Dedhia
  • 365
  • 2
  • 21
0
votes
1 answer

Error creating data frame with fewer elements than original dataframe-ified JSON

library(jsonlite) paths <- list.files( pattern="data.json", full.names=TRUE, recursive=TRUE ) colNames = c("BillType", "Congress", "IntroducedAt", "OfficialTitle", "Number", …
Caleb Faruki
  • 2,577
  • 3
  • 30
  • 54
0
votes
1 answer

R jsonlite parsing json array

I am using jsonlite to parse json values. json data set has arrays which jsonlite does not seem to be parsing. dataset: {"basicException":[{"assembly":"WCFTestCalcModel, Version=1.0.0.0, Culture=neutral,…
kumar
  • 8,207
  • 20
  • 85
  • 176
0
votes
0 answers

What is the best way to scrape this webpage? fromJSON doesnt seem to work

I have been happily scraping parts of this mobile app website using getURL and fromJSON (jsonlite package in R). For example, I have been using this code and it is fairly straight forward: CardURL =…
Tammboy
  • 321
  • 4
  • 14
0
votes
1 answer

syntax for jsonlite::fromJSON() or malformed JSON data?

I'm reading in a json formatted datasource and can't parse it to a dataframe that I'd like. jsontxt <-…
Jonathan
  • 491
  • 5
  • 19