-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch from RJSONIO to jsonlite #606
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 tasks
Updated comparisons with jsonlite 0.9.13.99, with compare <- function(x, ...) {
resr <- jsonlite::minify(RJSONIO::toJSON(x, ...))
resj <- jsonlite::minify(jsonlite::toJSON(x, dataframe="columns",
null="null", na="null", auto_unbox=TRUE, use_signif=TRUE, ...))
if (!identical(resr, resj)) {
cat(paste0("Results differ.",
"\nRJSONIO: ", resr,
"\njsonlite: ", resj
))
} else {
cat(resj)
}
invisible()
}
compare(list(2))
# [2]
compare(data.frame(x=1:2, y=c("a","b")))
# {"x":[1,2],"y":["a","b"]}
compare(
data.frame(x=c(1.2323123231, 5.12345678901234e19), y=c("a","b")),
digits = 2
)
# {"x":[1.2,5.1e+19],"y":["a","b"]}
# This is a RJSONIO bug
compare(list(x = matrix(nrow = 0, ncol = 1)))
# Error: parse error: unallowed token at this point in JSON text
# { "x": }
# (right here) ------^
compare(list(matrix(1:2, nrow=1)))
# [[[1,2]]]
compare(list(matrix(1:2, ncol=1)))
# [[[1],[2]]]
compare(list(x = matrix(1:4, nrow=2)))
# {"x":[[1,3],[2,4]]}
# Difference in 1x1 matrix - I think jsonlite is correct
compare(list(x = matrix(1)))
# Results differ.
# RJSONIO: {"x":[1]}
# jsonlite: {"x":[[1]]}
compare(list(x=NULL))
# {"x":null}
compare(list(as.data.frame(t(matrix(1:2, ncol=1)))))
# [{"V1":[1],"V2":[2]}]
compare(list(x=NULL))
# {"x":null}
compare(list(x=list()))
# {"x":[]}
compare(list(x=list(a=1)[0])) # Empty named list
# {"x":{}} |
wch
force-pushed
the
feature/jsonlite
branch
from
November 26, 2014 14:57
5505a88
to
8395520
Compare
wch
force-pushed
the
feature/jsonlite
branch
2 times, most recently
from
December 2, 2014 15:05
7f7ed66
to
dd7cd0f
Compare
If there is anything else you need from |
Thanks for asking! I think we're good, but we probably won't merge until after the next Shiny release. |
Closed
zeehio
added a commit
to zeehio/shinyFiles
that referenced
this pull request
Oct 2, 2016
Shiny switched to jsonlite in rstudio/shiny#606. Using jsonlite may fix thomasp85#43.
thomasp85
pushed a commit
to thomasp85/shinyFiles
that referenced
this pull request
Apr 29, 2017
* Update travis to sudo:false * RJSONIO to jsonlite Shiny switched to jsonlite in rstudio/shiny#606. Using jsonlite may fix #43.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes #572 and #228. I think we'd want jsonlite to support different behavior for digits before merging this.
I'm a bit less certain of the
fromJSON()
compatibility than I am oftoJSON
.Some comparisons: