Displaying 20 results from an estimated 44 matches for "fromjson".
2018 May 08
0
help with json data from the web into data frame in R
That said, I have two issues to ask for help with:
1) how to ignore cert errors with a fromJSON call
And
2) why the json data from the example link doesn't convert to a data frame. As seen in the following example
library("rjson")
result <- fromJSON(file = "https://www.semantic-mediawiki.org/w/api.php?action=ask&query=[[Category:City]]|?Capital%20of|?Has%20area&...
2018 May 08
3
help with json data from the web into data frame in R
...?https? and there is a certificate warning that I have to click through from a browser. That might be my issue. Is there any way in the json package to tell it to ignore self-signed cert errors in a url?
I didn't have that issue when using the link you offered:
library(jsonlite)
myJSON <- fromJSON( url("https://www.semantic-mediawiki.org/w/api.php?action=ask&query=%5B%5BCategory:City%5D%5D&format=json") )
# results in a complex list (not trivially reducible to a dataframe:
str(myJSON)
List of 1
$ query:List of 5
..$ printrequests:'data.frame': 1 obs. of 5 vari...
2018 May 08
3
help with json data from the web into data frame in R
> On May 8, 2018, at 9:03 AM, Evans, Richard K. (GRC-H000) <richard.k.evans at nasa.gov> wrote:
>
> That said, I have two issues to ask for help with:
>
> 1) how to ignore cert errors with a fromJSON call
If you can do it with curl, then why aren't you doing one of a) a system call, b) installing and loading RCurl, c) installing and loading curl (the R package with that name)?
>
> And
>
> 2) why the json data from the example link doesn't convert to a data frame.
That...
2018 May 08
3
help with json data from the web into data frame in R
...-project.org
Subject: Re: [R] help with json data from the web into data frame in R
> On May 8, 2018, at 9:03 AM, Evans, Richard K. (GRC-H000) <richard.k.evans at nasa.gov> wrote:
>
> That said, I have two issues to ask for help with:
>
> 1) how to ignore cert errors with a fromJSON call
If you can do it with curl, then why aren't you doing one of a) a system call, b) installing and loading RCurl, c) installing and loading curl (the R package with that name)?
>
> And
>
> 2) why the json data from the example link doesn't convert to a data frame.
That...
2018 May 09
1
help with json data from the web into data frame in R
...2
Lab cell 925-724-7509
?On 5/8/18, 9:03 AM, "R-help on behalf of Evans, Richard K. (GRC-H000)" <r-help-bounces at r-project.org on behalf of richard.k.evans at nasa.gov> wrote:
That said, I have two issues to ask for help with:
1) how to ignore cert errors with a fromJSON call
And
2) why the json data from the example link doesn't convert to a data frame. As seen in the following example
library("rjson")
result <- fromJSON(file = "https://www.semantic-mediawiki.org/w/api.php?action=ask&query=[[Category:City]...
2018 May 08
0
help with json data from the web into data frame in R
...-project.org
Subject: Re: [R] help with json data from the web into data frame in R
> On May 8, 2018, at 9:03 AM, Evans, Richard K. (GRC-H000) <richard.k.evans at nasa.gov> wrote:
>
> That said, I have two issues to ask for help with:
>
> 1) how to ignore cert errors with a fromJSON call
If you can do it with curl, then why aren't you doing one of a) a system call, b) installing and loading RCurl, c) installing and loading curl (the R package with that name)?
>
> And
>
> 2) why the json data from the example link doesn't convert to a data frame.
That...
2018 May 08
0
help with json data from the web into data frame in R
...ot;,"mode":2}],"results":{"File:2166320938 | __truncated__
- attr(*, "Content-Type")= Named chr [1:2] "application/json" "utf-8"
..- attr(*, "names")= chr [1:2] "" "charset"
#--- end console output-----
js1 <-fromJSON(zWebObj)
#--------
Error: lexical error: inside a string, '\' occurs before a character which it may not.
title":""}},"serializer":"SMW\Serializers\QueryResultSeriali
(right here) ------^
I'm not really a JSON expert, so am...
2018 May 08
2
help with json data from the web into data frame in R
...elf-signed cert errors in a url?
-Rich
From: Eric Berger [mailto:ericjberger at gmail.com]
Sent: Tuesday, May 08, 2018 11:31 AM
To: Evans, Richard K. (GRC-H000)
Cc: r-help at r-project.org
Subject: Re: [R] help with json data from the web into data frame in R
Hi Rich,
Take a look at the function fromJSON found in the rjson package.
Note that the Usage in the help page: ?fromJSON
names the second argument 'file' but if you look at the description the argument can be a URL.
HTH,
Eric
On Tue, May 8, 2018 at 6:16 PM, Evans, Richard K. (GRC-H000) <richard.k.evans at nasa.gov<mailto:rich...
2020 May 11
2
Segfault on read.socket with long message
...%d",port)
})
repeat {
## Input a hunk of stuff up to a blank line.
output <- character()
repeat {
inlen <- read.socket(sock,loop=TRUE)
flog.trace("Got message of length %s",inlen)
if (inlen=="quit") break
inmess <- fromJSON(read.socket(sock,as.integer(inlen)),false)
outmess <- doProcess(inmess)
output <- toJSON(outmess)
flog.trace("Sending message of length %s",nchar(output))
write.socket(sock,paste(nchar(output),"\n"))
write.socket(sock,output)
}
}...
2012 Jun 28
1
Mystery!!!
...ps in R 15.1.0 and the first one works and
produces results. However, the second one is not with initiating the object
as x[i]. Further, I was able to get the second loop work in R 15.0. Am I
missing something here?
for(i in 1:length(b))
{y[i]<-paste(a,b[i],c,sep="")
print(y[i])
print(fromJSON(file=y[i],method="C"))
}
for(i in 1:length(b))
{x[i]<-paste(a,b[i],c,sep="")
print(x[i])
print(fromJSON(file=x[i],method="C"))
}
Thanks
Arun
--
View this message in context: http://r.789695.n4.nabble.com/Mystery-tp4634758.html
Sent from the R help mailing list a...
2013 Aug 29
0
Big Integer Support in JSON-to-R Conversion
...are included in the JSON
string.
A simple example of the problem is:
> options(scipen=999) # To prevent representing the answer in scientific
notation
> json.str <- '{"bigInt":123456789123456789}' # Sample JSON string with
big integer
Using the RJSONIO package:
> fromJSON(json.str) # From package 'RJSONIO'
bigInt
123456789123456784
Using the rjson package:
> fromJSON(json.str) # From package 'rjson'
$bigInt
[1] 123456789123456784
Notice the difference in the last digit (4 vs. 9).
In my research, I have come across various ways to...
2012 Dec 04
1
Reading JSON files from R
...nd such.
Also, i understand that in reading the JSON file RJSONIO will automatically
create the necessary structures. However I cannot seem to use to to read the
file properly and get this error:
Error in function (classes, fdef, mtable) :
unable to find an inherited method for function "fromJSON", for signature
"missing", "NULL"
The call I am making is:
noSqlData <- fromJSON(file='data.json')
It is a small file - with 3 levels of nested records.
And if there were some links to some examples with a file and usage would be
great. My JSON file validates...
2020 May 12
1
Segfault on read.socket with long message
...formation about how to join the
bugzilla site was not available at bugzilla and buried in the CRAN web
site instructions on reporting bugs (which pointed me at Bugzilla and
not the page you showed me).
The example is pretty minimal.? I left the tracing statements
(flog.trace()) and the toJSON, fromJSON in as I thought they might
provide some context for another method of approaching my problem.
It looks like I'm getting better results using socketConnection() rather
than read.socket(), so I'll pursue that solution (but still file a bug
report, as it seg faults are never good).
??? -...
2012 Jun 19
1
need help with unlist(), losing NULL values
Hi,
I have a very rudimentary kind of question on using unlist(). I am
parsing a bunch of JSON text using rjson package. Some data elements in
a dictionary happen to be null which rjson parses correctly.
> fromJSON(json_str='{"query":{"A":10, "B":null, "C":"hello"},
"query":{"A":20, "B":null, "C":"hello again"}}')
$query
$query$A
[1] 10
$query$B
NULL
$query$C
[1] "hello"
$query
$query$A
[...
2018 May 08
0
help with json data from the web into data frame in R
...?https? and there is a certificate warning that I have to click through from a browser. That might be my issue. Is there any way in the json package to tell it to ignore self-signed cert errors in a url?
I didn't have that issue when using the link you offered:
library(jsonlite)
myJSON <- fromJSON( url("https://www.semantic-mediawiki.org/w/api.php?action=ask&query=%5B%5BCategory:City%5D%5D&format=json") )
# results in a complex list (not trivially reducible to a dataframe:
str(myJSON)
List of 1
$ query:List of 5
..$ printrequests:'data.frame': 1 obs. of 5 vari...
2017 Sep 03
2
readLines() segfaults on large file & question on how to work around
...ad not heard of and is
exactly my case.
My experience:
jsonlite::stream_in - segfaults
ndjson::stream_in - my fault, I am running Ubuntu 14.04 and it is too old
so it won't compile the package
corpus::read_ndjson - works!!! Of course it does a different simplification
than jsonlite::fromJSON, so I have to change some code, but it works
beautifully at least in simple tests. The memory-map option may be of
use in the future.
Another correspondent said that strings in R can only be 2^31-1 long, which
is why any "solution" that tries to load the whole file into R first...
2018 May 08
0
help with json data from the web into data frame in R
Hi Rich,
Take a look at the function fromJSON found in the rjson package.
Note that the Usage in the help page: ?fromJSON
names the second argument 'file' but if you look at the description the
argument can be a URL.
HTH,
Eric
On Tue, May 8, 2018 at 6:16 PM, Evans, Richard K. (GRC-H000) <
richard.k.evans at nasa.gov> wrote:
&...
2017 Sep 02
5
readLines() segfaults on large file & question on how to work around
Hi:
I have a 2.1GB JSON file. Typically I use readLines() and
jsonlite:fromJSON() to extract data from a JSON file.
When I try and read in this file using readLines() R segfaults.
I believe the two salient issues with this file are
1). Its size
2). It is a single line (no line breaks)
I can reproduce this issue as follows
#Generate a big file with no line breaks
# In R
>...
2010 Feb 18
3
parsing strings between [ ] in columns
Dear all,
I have a data.frame with a column like the x shown below
myDF<-data.frame(cbind(x=c("[[1, 0, 0], [0, 1]]",
"[[1, 1, 0], [0, 1]]","[[1, 0, 0], [1, 1]]",
"[[0, 0, 1], [0, 1]]")))
> myDF
x
1 [[1, 0, 0], [0, 1]]
2 [[1, 1, 0], [0, 1]]
3 [[1, 0, 0], [1, 1]]
4 [[0, 0, 1], [0, 1]]
As you can see my x column is composed of
2018 May 08
2
help with json data from the web into data frame in R
Hello
I am able to construct a url that points to some data online in the JSON format. See an example at [0].
I would like to work with this data as a dataframe in R.
I know that there is a package for handling json data [1] but it assumes the data is in a local file but It is not clear to me how to request the data from the web in an R script and get the json data converted into a data frame