You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using jsonlite::validate on an invalid json character string, the resulting error message can appear later in the parsed JSON for valid false JSON data.
For example, when running this code:
library(jsonlite)
sessionInfo()
fromJSON('false') # This works just fine
validate('') # Validate that '' is not valid JSON
fromJSON('false') # This now picks up the error message from validate('')
fromJSON('true') # But this is fine
The output produced is:
> library(jsonlite)
Attaching package: ‘jsonlite’
The following object is masked from ‘package:utils’:
View
Warning message:
package ‘jsonlite’ was built under R version 3.1.2
> sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: x86_64-apple-darwin13.1.0 (64-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] jsonlite_0.9.13
> fromJSON('false') # This works just fine
[1] FALSE
> validate('') # Validate that '' is not valid JSON
[1] FALSE
attr(,"err")
[1] "parse error: premature EOF\n \n (right here) ------^\n"
> fromJSON('false') # This now picks up the error message from validate('')
[1] FALSE
attr(,"err")
[1] "parse error: premature EOF\n \n (right here) ------^\n"
> fromJSON('true') # But this is fine
[1] TRUE
>
The text was updated successfully, but these errors were encountered:
When using
jsonlite::validate
on an invalid json character string, the resulting error message can appear later in the parsed JSON for validfalse
JSON data.For example, when running this code:
The output produced is:
The text was updated successfully, but these errors were encountered: