Skip to content

Commit 51ceccf

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 1303f31 + 461c416 commit 51ceccf

File tree

106 files changed

+1015
-1073
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+1015
-1073
lines changed

.Rbuildignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,5 @@ vignettes/framed.sty$
3131
^revdep$
3232
^CODE_OF_CONDUCT\.md$
3333
^\.github$
34+
^air.toml$
35+

.github/workflows/R-CMD-check.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
matrix:
1818
config:
1919
- {os: macOS-latest, r: 'release'}
20+
- {os: macOS-15, r: 'next'}
2021
- {os: windows-2022, r: 'devel'}
2122
- {os: windows-latest, r: '4.1'}
2223
- {os: windows-latest, r: '3.6'}
@@ -47,3 +48,5 @@ jobs:
4748
extra-packages: rcmdcheck
4849

4950
- uses: r-lib/actions/check-r-package@v2
51+
env:
52+
MAKEFLAGS: -j4

DESCRIPTION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: jsonlite
2-
Version: 1.8.9.999
3-
Title: A Robust, High Performance JSON Parser and Generator for R (adjusted for use in MIRO)
2+
Version: 2.0.0.999
3+
Title: A Simple and Robust JSON Parser and Generator for R (adjusted for use in MIRO)
44
License: MIT + file LICENSE
55
Depends: methods
66
Authors@R: c(
@@ -30,6 +30,6 @@ Suggests:
3030
rmarkdown,
3131
R.rsp,
3232
sf
33-
RoxygenNote: 7.2.3
33+
RoxygenNote: 7.3.2
3434
Encoding: UTF-8
3535
Roxygen: list(markdown = TRUE)

NEWS

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
2.0.0
2+
- Output for toJSON(x, pretty = p) where p is a number has changed: now uses
3+
the same r-based indent system as for pretty = TRUE. To get the old format,
4+
run json output through prettify().
5+
- Both toJSON() and prettify() support now can use tabs instead of spaces by
6+
setting a negative number as indent/pretty argument.
7+
- Fix an ubsan warning in prettify/minify in libyajl
8+
- Reformatted code with air
9+
10+
1.9.1
11+
- Fix a unit test in R 4.5 due to the new 'penguins_raw' dataset
12+
13+
1.9.0
14+
- Remove legacy modp_stdint.h which breaks in C23 on Windows (R-4.5)
15+
116
1.8.9
217
- Fix memory leak in base64 decoder
318
- Update maintainer email address

R/apply_by_pages.R

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
apply_by_pages <- function(x, FUN, pagesize, verbose, ...){
1+
apply_by_pages <- function(x, FUN, pagesize, verbose, ...) {
22
stopifnot(is.data.frame(x))
33
nr <- nrow(x)
4-
npages <- nr %/% pagesize;
5-
lastpage <- nr %% pagesize;
4+
npages <- nr %/% pagesize
5+
lastpage <- nr %% pagesize
66

77
out <- as.list(rep(NA, npages + as.logical(lastpage)))
8-
for(i in seq_len(npages)){
9-
from <- pagesize * (i-1) + 1;
8+
for (i in seq_len(npages)) {
9+
from <- pagesize * (i - 1) + 1
1010
to <- pagesize * i
11-
out[[i]] <- FUN(x[from:to, ,drop = FALSE], ...)
12-
if(verbose) cat("\rProcessed", i * pagesize, "rows...")
11+
out[[i]] <- FUN(x[from:to, , drop = FALSE], ...)
12+
if (verbose) cat("\rProcessed", i * pagesize, "rows...")
1313
}
1414

15-
if(lastpage){
16-
from <- nr - lastpage + 1;
17-
out[[npages + 1]] <- FUN(x[from:nr, ,drop = FALSE], ...)
15+
if (lastpage) {
16+
from <- nr - lastpage + 1
17+
out[[npages + 1]] <- FUN(x[from:nr, , drop = FALSE], ...)
1818
}
19-
if(verbose) cat("\rComplete! Processed total of", nr, "rows.\n")
19+
if (verbose) cat("\rComplete! Processed total of", nr, "rows.\n")
2020
out
2121
}
2222

2323
#this is another slightly slower implementation
24-
apply_by_pages2 <- function(x, FUN, pagesize, verbose, ...){
24+
apply_by_pages2 <- function(x, FUN, pagesize, verbose, ...) {
2525
x2 <- split(x, seq_len(nrow(x)) %/% pagesize)
26-
for(page in x2){
27-
if(verbose) message("Writing ", nrow(page), " lines (", ").")
26+
for (page in x2) {
27+
if (verbose) message("Writing ", nrow(page), " lines (", ").")
2828
FUN(page)
2929
}
3030
invisible()

R/as.scalar.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
as.scalar <- function(obj) {
22
# Lists can never be a scalar (this can arise if a dataframe contains a column
33
# with lists)
4-
if(length(dim(obj)) > 1){
5-
if(!identical(nrow(obj), 1L)){
6-
warning("Tried to use as.scalar on an array or dataframe with ", nrow(obj), " rows.", call.=FALSE)
4+
if (length(dim(obj)) > 1) {
5+
if (!identical(nrow(obj), 1L)) {
6+
warning("Tried to use as.scalar on an array or dataframe with ", nrow(obj), " rows.", call. = FALSE)
77
return(obj)
88
}
9-
} else if(!identical(length(obj), 1L)) {
10-
warning("Tried to use as.scalar on an object of length ", length(obj), call.=FALSE)
9+
} else if (!identical(length(obj), 1L)) {
10+
warning("Tried to use as.scalar on an object of length ", length(obj), call. = FALSE)
1111
return(obj)
12-
} else if(is.namedlist(obj)){
13-
warning("Tried to use as.scalar on a named list.", call.=FALSE)
12+
} else if (is.namedlist(obj)) {
13+
warning("Tried to use as.scalar on a named list.", call. = FALSE)
1414
return(obj)
1515
}
1616

R/asJSON.AAAgeneric.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ setGeneric("asJSON", function(x, ...) {
22
standardGeneric("asJSON")
33
})
44

5-
if(getRversion() < "4"){
5+
if (getRversion() < "4") {
66
setOldClass("AsIs")
77
setOldClass("integer64")
88
setOldClass(c("hms", "difftime"))

R/asJSON.AsIs.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
setMethod("asJSON", "AsIs", function(x, auto_unbox = FALSE, ...) {
2-
32
# Strip off the AsIs class so we can dispatch to other asJSON methods.
43
class(x) <- setdiff(class(x), "AsIs")
54

65
if (is.atomic(x) && length(x) == 1) {
76
# Never auto_unbox single values when wrapped with I()
87
asJSON(x, auto_unbox = FALSE, ...)
9-
108
} else {
119
asJSON(x, auto_unbox = auto_unbox, ...)
1210
}

R/asJSON.Date.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
setMethod("asJSON", "Date", function(x, Date = c("ISO8601", "epoch"), always_decimal = FALSE, ...) {
2-
32
# Validate argument
43
Date <- match.arg(Date)
54

65
# select a schema
7-
output <- switch(Date,
6+
output <- switch(
7+
Date,
88
ISO8601 = format(x),
99
epoch = unclass(x),
1010
default = stop("Invalid argument for 'Date':", Date)

R/asJSON.NULL.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Note that this is different from RJSONIO because null values are NA.
22
setMethod("asJSON", "NULL", function(x, null = "list", ...) {
3-
if(null == "null"){
3+
if (null == "null") {
44
return("null")
55
} else {
66
return("{}")

0 commit comments

Comments
 (0)