Skip to content

Commit

Permalink
version 0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
David Cooley authored and cran-robot committed Jan 10, 2019
1 parent 1653e9a commit 90a6ffe
Show file tree
Hide file tree
Showing 49 changed files with 3,156 additions and 706 deletions.
13 changes: 7 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
Package: jsonify
Type: Package
Title: Converts 'R' Objects to Javascript Object Notation (JSON)
Version: 0.1.2
Date: 2018-12-07
Version: 0.2.0
Date: 2019-01-10
Authors@R: c(
person("David", "Cooley", ,"dcooley@symbolix.com.au", role = c("aut", "cre"))
)
Description: Converts 'R' objects into Javascript Object Notation (JSON) using
the 'rapidjsonr' library <https://CRAN.R-project.org/package=rapidjsonr>.
License: GPL (>= 2)
Imports: Rcpp (>= 0.12.18)
LinkingTo: rapidjsonr, Rcpp
LinkingTo: BH, rapidjsonr, Rcpp
RoxygenNote: 6.1.0
Suggests: covr, microbenchmark, jsonlite, testthat
Suggests: covr, microbenchmark, jsonlite, testthat, knitr, rmarkdown
Encoding: UTF-8
VignetteBuilder: knitr
NeedsCompilation: yes
Packaged: 2018-12-07 04:35:04 UTC; david
Packaged: 2019-01-10 02:34:15 UTC; david
Author: David Cooley [aut, cre]
Maintainer: David Cooley <dcooley@symbolix.com.au>
Repository: CRAN
Date/Publication: 2018-12-07 05:30:08 UTC
Date/Publication: 2019-01-10 13:10:03 UTC
72 changes: 46 additions & 26 deletions MD5
Original file line number Diff line number Diff line change
@@ -1,31 +1,51 @@
2c71949c45295e080dc9a9d7fa54099e *DESCRIPTION
1b9b154ef61b86c038d7495114a6449b *NAMESPACE
31c7b857cd716d33235c88d9a6be2324 *NEWS.md
b142c1652ae7c92dc3b5d5c604820dbf *R/RcppExports.R
812a38a55a19c772e338da02b21b9748 *R/jsondf-package.R
659cb5e4909e9e5c41f8a9edae3262cf *R/to_json.R
5e206d57ce3b69d0b85e9d7e44264bd2 *DESCRIPTION
866e58bbadb514751bc5ca0af9a21d1a *NAMESPACE
6af5b4ae781d428ab257aa6523e356d4 *NEWS.md
8eaca68562168f33118d8289a83a7fff *R/RcppExports.R
f4f96fe559515f2104bc31b7c0b735a9 *R/jsonify-package.R
a04d897041e3119671a6302c060fdd83 *R/pretty.R
c7470557480c0253917036af0520c062 *R/to_json.R
20a7a8d3f4290263ffae684ffa763ea1 *R/validate.R
6d90fd4675fdc41a703be8dffcce0d16 *README.md
334ce8201a2aea780d09bd9158f23437 *inst/include/jsonify/jsonify.hpp
4e4739600c18f48e95e012973dc3cad4 *inst/include/jsonify/to_json.hpp
5eb1be0b0bd3867a8bc5fbfa02a5142a *inst/include/jsonify/to_json/dataframe.hpp
0e5d4c61402ebb87ccb8848372a97d3d *inst/include/jsonify/to_json/matrix.hpp
3dcd96b48731035ade4472351323cd4e *inst/include/jsonify/to_json/vectors.hpp
b102e37d9e405b6a42432612d9050dbe *inst/include/jsonify/to_json/writers.hpp
dded494accae9e12f6e2cd5c2ef8b936 *inst/include/jsonify/utils.hpp
0b323f441784c475904625b9a1b9445f *inst/include/jsonify/validate/validate.hpp
008947787d1c9e52a5d4a4ca53efa780 *man/jsondf-package.Rd
1239d3be36e0d213722ff5b5b1c5293e *man/to_json.Rd
ccc78ed93079f6af023a4c1e31710f28 *README.md
8b56b39635d92e82f9c8b89fad0e63f2 *build/vignette.rds
368db90575c7a57589d9678ef3b2ef3f *inst/doc/jsonify.R
1bc597feed012bbf300c942fcbe31970 *inst/doc/jsonify.Rmd
19ed7a7fabae6b05cc95100c7eaec1e1 *inst/doc/jsonify.html
d8b5acd6c406992fee295c11a8442639 *inst/include/jsonify/jsonify.hpp
7c9511052d220aa02d18629ab30941eb *inst/include/jsonify/to_json.hpp
09c2278b61e07b893c4ef708675249a2 *inst/include/jsonify/to_json/api.hpp
52b2e64414034fb1b5c373f4ce6206fd *inst/include/jsonify/to_json/dataframe.hpp
e2a4ca43c368bf0cd11119e5bc02779e *inst/include/jsonify/to_json/dates/dates.hpp
da39a3c9c0408a3fa14e466ccc7f3357 *inst/include/jsonify/to_json/utils.hpp
f1f96c9218bfd44ae32ca54dc9bde60b *inst/include/jsonify/to_json/vectors.hpp
f64c0358510cace1f4ffc05d6459d50a *inst/include/jsonify/to_json/writers.hpp
b1af5dc4efd8057202e8612d4245200b *inst/include/jsonify/to_json/writers/complex.hpp
ae9841cc230e7bf5bd1c7bc5ea7488e7 *inst/include/jsonify/to_json/writers/scalars.hpp
c26d544f3b0bb24436aa629dd1eac031 *inst/include/jsonify/to_json/writers/simple.hpp
2b3ee96c5682e1c5033c0f43b3ef4246 *inst/include/jsonify/utils.hpp
58bcdfb40c21a2b74042f6a12f8ad6a0 *inst/include/jsonify/validate/validate.hpp
366796a001dfc8436334b6b7e269ebc6 *man/minify_json.Rd
897b0fe1cf53f90b94e03e79d2299103 *man/pretty_json.Rd
9ca48ecf4f466dac5d500aaca24a3bb1 *man/to_json.Rd
5941dbbcf86d62d4e16fa337786ad933 *man/validate_json.Rd
0041a471f125130e1231dfd2686fab9e *src/Makevars
0041a471f125130e1231dfd2686fab9e *src/Makevars.win
4689540caf7af319384274509b6c016e *src/RcppExports.cpp
3cdd8243c7a4e52c2ed1bda95f7dca69 *src/to_json.cpp
892845ba51ae56655f7b4ca6e7dd85d2 *src/validate.cpp
375159a7782a80dfc649e066b0c6a5d1 *src/RcppExports.cpp
a6e2400c0308e77184a9e0d0c30c56fe *src/pretty.cpp
5ef3e2620c9744d6429650167c8fcf99 *src/tests.cpp
c427389b0fb0871a5e3512aa837bcbf9 *src/to_json.cpp
c88e4479fecc103a86f0b57622aa6540 *src/validate.cpp
42a43436990b6079b23f962ca6336629 *tests/testthat.R
760ae9c29ac661df661d299b6a8f86b8 *tests/testthat/test-to_json_dataframe.R
ec9e0c39b8862f1fa48eaba5a1ad690b *tests/testthat/test-to_json_lists.R
5478770887b01147c6c6005a84e763a7 *tests/testthat/test-to_json_matrix.R
fe71a0ea4b0e90a983cb76546422e5fc *tests/testthat/test-to_json_vectors.R
5054abfef804071e016be0c3cd4de7c0 *tests/testthat/test-unbox.R
659f74d17897b7d66773ea0b34265d8d *tests/testthat/test-validate.R
2391b7ebae8abb7a64fece1bd9c3df5e *tests/testthat/test-to_json_SEXPTYPE.R
58df5ab41f2526ea97fcfa9ce66b5d05 *tests/testthat/test-to_json_column.R
f32a1358185e76ac5fca74f09ecde37d *tests/testthat/test-to_json_dataframe.R
84a0991d846a87a4a954d9245a92fa4c *tests/testthat/test-to_json_dates.R
e2ce3d801ad29a6049f182a6be6aa5f0 *tests/testthat/test-to_json_digits.R
2c208f0ea95f892f72c508c04883b722 *tests/testthat/test-to_json_lists.R
78d8d96f76925e1f4320ae3be46d2252 *tests/testthat/test-to_json_matrix.R
202cd7eced938c1afa66b1e437ab7077 *tests/testthat/test-to_json_prettify.R
9172b3a63f4d94acfe6dcb7f12ae899a *tests/testthat/test-to_json_src.R
6cffe82cb4f30ce05a180bea7c5bdf61 *tests/testthat/test-to_json_unbox.R
659f74d17897b7d66773ea0b34265d8d *tests/testthat/test-to_json_validate.R
b167a873b1b1c44382015ca4ccea6244 *tests/testthat/test-to_json_vectors.R
1bc597feed012bbf300c942fcbe31970 *vignettes/jsonify.Rmd
19 changes: 7 additions & 12 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
# Generated by roxygen2: do not edit by hand

S3method(to_json,Date)
S3method(to_json,POSIXct)
S3method(to_json,POSIXlt)
S3method(to_json,character)
S3method(to_json,complex)
S3method(to_json,data.frame)
S3method(to_json,default)
S3method(to_json,integer)
S3method(to_json,list)
S3method(to_json,logical)
S3method(to_json,matrix)
S3method(to_json,numeric)
S3method(minify_json,default)
S3method(minify_json,json)
S3method(pretty_json,default)
S3method(pretty_json,json)
S3method(print,json)
S3method(validate_json,character)
S3method(validate_json,default)
S3method(validate_json,json)
export(minify_json)
export(pretty_json)
export(to_json)
export(validate_json)
importFrom(Rcpp,sourceCpp)
Expand Down
14 changes: 13 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
# jsonify 0.1.2
## v0.2.0

* by column | row option
* factors_as_string argument
* Support for LANGSXP objects
* Dates are handled in c++, and now supports nested lists
* c++ API restructured and simplified
* `print.json()` method to print json class objects
* `minify_json()` function to remove indentation
* `pretty_json()` function to add indentation
* `digits` argument to specify the number of digits to which numeric values will be rounded

## v0.1.2

* `unbox` argument for `to_json()`
* Added a `NEWS.md` file to track changes to the package.
40 changes: 12 additions & 28 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
@@ -1,43 +1,27 @@
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

rcpp_df_to_json <- function(df, unbox = FALSE) {
.Call(`_jsonify_rcpp_df_to_json`, df, unbox)
rcpp_pretty_json <- function(json) {
.Call(`_jsonify_rcpp_pretty_json`, json)
}

rcpp_numeric_to_json <- function(nv, unbox = FALSE) {
.Call(`_jsonify_rcpp_numeric_to_json`, nv, unbox)
rcpp_minify_json <- function(json) {
.Call(`_jsonify_rcpp_minify_json`, json)
}

rcpp_character_to_json <- function(sv, unbox = FALSE) {
.Call(`_jsonify_rcpp_character_to_json`, sv, unbox)
rcpp_pretty_print <- function(json) {
invisible(.Call(`_jsonify_rcpp_pretty_print`, json))
}

rcpp_integer_to_json <- function(iv, unbox = FALSE) {
.Call(`_jsonify_rcpp_integer_to_json`, iv, unbox)
source_tests <- function() {
invisible(.Call(`_jsonify_source_tests`))
}

rcpp_logical_to_json <- function(iv, unbox = FALSE) {
.Call(`_jsonify_rcpp_logical_to_json`, iv, unbox)
rcpp_to_json <- function(lst, unbox = FALSE, digits = -1L, numeric_dates = TRUE, factors_as_string = TRUE, by = "row") {
.Call(`_jsonify_rcpp_to_json`, lst, unbox, digits, numeric_dates, factors_as_string, by)
}

rcpp_list_to_json <- function(lst, unbox = FALSE) {
.Call(`_jsonify_rcpp_list_to_json`, lst, unbox)
}

rcpp_integer_matrix_to_json <- function(m, unbox = FALSE) {
.Call(`_jsonify_rcpp_integer_matrix_to_json`, m, unbox)
}

rcpp_numeric_matrix_to_json <- function(m, unbox = FALSE) {
.Call(`_jsonify_rcpp_numeric_matrix_to_json`, m, unbox)
}

rcpp_character_matrix_to_json <- function(m, unbox = FALSE) {
.Call(`_jsonify_rcpp_character_matrix_to_json`, m, unbox)
}

rcpp_validate_json <- function(geojson) {
.Call(`_jsonify_rcpp_validate_json`, geojson)
rcpp_validate_json <- function(json) {
.Call(`_jsonify_rcpp_validate_json`, json)
}

2 changes: 1 addition & 1 deletion R/jsondf-package.R → R/jsonify-package.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#' @useDynLib jsonify, .registration = TRUE
#' @importFrom Rcpp sourceCpp
NULL
NULL
58 changes: 58 additions & 0 deletions R/pretty.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@

#' @export
print.json <- function( x, ... ) cat( x )

#' Pretty Json
#'
#' Adds indentiation to a JSON string
#'
#' @param json string of JSON
#' @param ... other argments passed to \link{to_json}
#'
#' @examples
#'
#' df <- data.frame(id = 1:10, val = rnorm(10))
#' js <- to_json( df )
#' pretty_json(js)
#'
#' ## can also use directly on an R object
#' pretty_json( df )
#'
#' @export
pretty_json <- function( json, ... ) UseMethod("pretty_json")

#' @export
pretty_json.json <- function( json, ... ) rcpp_pretty_json( json )

#' @export
pretty_json.default <- function( json, ... ) {
js <- to_json( json, ... )
rcpp_pretty_json( js )
}


#' Minify Json
#'
#' Removes indentiation from a JSON string
#'
#' @param json string of JSON
#' @param ... other argments passed to \link{to_json}
#'
#' @examples
#'
#' df <- data.frame(id = 1:10, val = rnorm(10))
#' js <- to_json( df )
#' jsp <- pretty_json(js)
#' minify_json( jsp )
#'
#' @export
minify_json <- function( json, ... ) UseMethod("minify_json")

#' @export
minify_json.json <- function( json, ... ) rcpp_minify_json( json )

#' @export
minify_json.default <- function( json, ... ) to_json( json, ... )



0 comments on commit 90a6ffe

Please sign in to comment.