Skip to content

Commit

Permalink
version 0.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
David Cooley authored and cran-robot committed Apr 24, 2019
1 parent 90a6ffe commit 57fc3a8
Show file tree
Hide file tree
Showing 19 changed files with 352 additions and 525 deletions.
10 changes: 5 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: jsonify
Type: Package
Title: Converts 'R' Objects to Javascript Object Notation (JSON)
Version: 0.2.0
Date: 2019-01-10
Version: 0.2.1
Date: 2019-04-24
Authors@R: c(
person("David", "Cooley", ,"dcooley@symbolix.com.au", role = c("aut", "cre"))
)
Expand All @@ -11,13 +11,13 @@ Description: Converts 'R' objects into Javascript Object Notation (JSON) using
License: GPL (>= 2)
Imports: Rcpp (>= 0.12.18)
LinkingTo: BH, rapidjsonr, Rcpp
RoxygenNote: 6.1.0
RoxygenNote: 6.1.1
Suggests: covr, microbenchmark, jsonlite, testthat, knitr, rmarkdown
Encoding: UTF-8
VignetteBuilder: knitr
NeedsCompilation: yes
Packaged: 2019-01-10 02:34:15 UTC; david
Packaged: 2019-04-24 07:25:49 UTC; dave
Author: David Cooley [aut, cre]
Maintainer: David Cooley <dcooley@symbolix.com.au>
Repository: CRAN
Date/Publication: 2019-01-10 13:10:03 UTC
Date/Publication: 2019-04-24 08:00:03 UTC
29 changes: 13 additions & 16 deletions MD5
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
5e206d57ce3b69d0b85e9d7e44264bd2 *DESCRIPTION
866e58bbadb514751bc5ca0af9a21d1a *NAMESPACE
6af5b4ae781d428ab257aa6523e356d4 *NEWS.md
e43540a03674382f47e00aa8e443c3bc *DESCRIPTION
e3396a113fa8d2a964d08b38899595f8 *NAMESPACE
d40c86eba1a480167cfdb9818464c852 *NEWS.md
8eaca68562168f33118d8289a83a7fff *R/RcppExports.R
f4f96fe559515f2104bc31b7c0b735a9 *R/jsonify-package.R
a04d897041e3119671a6302c060fdd83 *R/pretty.R
c7470557480c0253917036af0520c062 *R/to_json.R
d8ba5aa7f7a3b3de44d4b02c7e23f29a *R/pretty.R
049ba9833887df828aa54052bdcb7dcb *R/to_json.R
20a7a8d3f4290263ffae684ffa763ea1 *R/validate.R
ccc78ed93079f6af023a4c1e31710f28 *README.md
8b56b39635d92e82f9c8b89fad0e63f2 *build/vignette.rds
e1c4cc716894cc616231d4da5ec3e837 *build/vignette.rds
368db90575c7a57589d9678ef3b2ef3f *inst/doc/jsonify.R
1bc597feed012bbf300c942fcbe31970 *inst/doc/jsonify.Rmd
19ed7a7fabae6b05cc95100c7eaec1e1 *inst/doc/jsonify.html
2ae9f98982ff64aabe42745e4363f9a1 *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
3c8bb1b5f8b791ac5dee8ac26051c7d1 *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
0006a142a075f67c9c3d6efdc41d6b0a *inst/include/jsonify/to_json/writers/simple.hpp
58bcdfb40c21a2b74042f6a12f8ad6a0 *inst/include/jsonify/validate/validate.hpp
98e3db3ec324a6d88de4e48e23ec0dad *man/as.json.Rd
366796a001dfc8436334b6b7e269ebc6 *man/minify_json.Rd
897b0fe1cf53f90b94e03e79d2299103 *man/pretty_json.Rd
9ca48ecf4f466dac5d500aaca24a3bb1 *man/to_json.Rd
Expand All @@ -36,9 +32,10 @@ a6e2400c0308e77184a9e0d0c30c56fe *src/pretty.cpp
c427389b0fb0871a5e3512aa837bcbf9 *src/to_json.cpp
c88e4479fecc103a86f0b57622aa6540 *src/validate.cpp
42a43436990b6079b23f962ca6336629 *tests/testthat.R
dc85f566ec0f3bbbf03aeaa3d33bc47e *tests/testthat/test-as_json.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
b5a7f8fd0ffca25c80abcdeee38ddda2 *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
Expand All @@ -47,5 +44,5 @@ e2ce3d801ad29a6049f182a6be6aa5f0 *tests/testthat/test-to_json_digits.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
a9a98e46d1a7e323ffb0f0a0ca6007b2 *tests/testthat/test-to_json_vectors.R
1bc597feed012bbf300c942fcbe31970 *vignettes/jsonify.Rmd
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# Generated by roxygen2: do not edit by hand

S3method(minify_json,character)
S3method(minify_json,default)
S3method(minify_json,json)
S3method(pretty_json,character)
S3method(pretty_json,default)
S3method(pretty_json,json)
S3method(print,json)
S3method(validate_json,character)
S3method(validate_json,default)
S3method(validate_json,json)
export(as.json)
export(minify_json)
export(pretty_json)
export(to_json)
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## v0.2.1

* `as.json()` method
* Bug fix: AsIs data.frame inside another data.frame [issue #38](https://github.com/SymbolixAU/jsonify/issues/38)

## v0.2.0

* by column | row option
Expand Down
6 changes: 6 additions & 0 deletions R/pretty.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ pretty_json <- function( json, ... ) UseMethod("pretty_json")
#' @export
pretty_json.json <- function( json, ... ) rcpp_pretty_json( json )

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

#' @export
pretty_json.default <- function( json, ... ) {
js <- to_json( json, ... )
Expand Down Expand Up @@ -51,6 +54,9 @@ minify_json <- function( json, ... ) UseMethod("minify_json")
#' @export
minify_json.json <- function( json, ... ) rcpp_minify_json( json )

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

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

Expand Down
19 changes: 16 additions & 3 deletions R/to_json.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,22 @@ handle_digits <- function( digits ) {
return( as.integer( digits ) )
}

#' Coerce string to JSON
#'
#' @param x string to coerce to JSON
#'
#' @examples
#'
#' js <- '{"x":1,"y":2}'
#' as.json(js)
#'
#' @export
as.json <- function(x) {
if( !jsonify::validate_json( x ) )
stop("Invalid JSON")




attr(x, "class") <- "json"
x
}


Binary file modified build/vignette.rds
Binary file not shown.

0 comments on commit 57fc3a8

Please sign in to comment.