Skip to content

Commit 33bc472

Browse files
committed
bug fix: JSON j_pivot() connection
1 parent 9b283db commit 33bc472

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: rjsoncons
22
Title: 'C++' Header-Only 'jsoncons' Library for 'JSON' Queries
3-
Version: 1.2.0
3+
Version: 1.2.0.9000
44
Authors@R: c(
55
person(
66
"Martin", "Morgan", role = c("aut", "cre"),

NEWS.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# rjsoncons 1.3.0
2+
3+
- (1.2.0.9000) bug fix: support JSON `j_pivot()` file / url connections
4+
15
# rjsoncons 1.2.0
26

37
- (1.1.0.9500) update documentation, include NDJSON-specific, web-only

R/json.R

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ json_pivot <-
3232
if (identical(data_type, "R"))
3333
data_type <- "json"
3434

35+
data_type <- head(data_type, 1L)
3536
as0 <- ifelse(identical(as, "string"), as, "R")
3637
ex <- cpp_r_json_init(object_names, path, as0, data_type, path_type)
3738
cpp_r_json_pivot(ex, data, object_names)

inst/tinytest/test_j_query.R

+16
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,20 @@ expect_identical(
120120
'{"name":["Seattle"],"state":["WA"]}'
121121
)
122122

123+
expect_identical(
124+
j_pivot(json_file, "locations[]", as = "R"),
125+
list(
126+
name = c("Seattle", "New York", "Bellevue", "Olympia"),
127+
state = c("WA", "NY", "WA", "WA")
128+
)
129+
)
130+
131+
expect_identical(
132+
j_pivot(ndjson_file, "", as = "R"),
133+
list(
134+
name = c("Seattle", "New York", "Bellevue", "Olympia"),
135+
state = c("WA", "NY", "WA", "WA")
136+
)
137+
)
138+
123139
expect_error(j_pivot(json, "locations[0].name"))

0 commit comments

Comments
 (0)