The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

zujson

CRAN status Lifecycle: experimental R-CMD-check coverage

zujson is a JSON parser and writer that converts between JSON and ordinary R vectors and lists by a small, documented type mapping.

Installation

Install the released version from CRAN:

install.packages("zujson")

Or the development version from GitHub:

# install.packages("pak")
pak::pak("pedrobtz/zujson")

Usage

library(zujson)

json_parse() reads JSON into R. An object becomes a named list, and an array whose elements share a type becomes an atomic vector:

str(json_parse('{"ok": true, "ids": [1, 2, 3], "next": null}'))
#> List of 3
#>  $ ok  : logi TRUE
#>  $ ids : int [1:3] 1 2 3
#>  $ next: NULL

json_write() goes the other way. A fully named list becomes an object, a vector an array, and a length-one vector a bare value:

cat(json_write(list(query = "cats", limit = 10L, tags = c("a", "b"))))
#> {"query":"cats","limit":10,"tags":["a","b"]}

zujson also reads files and NDJSON, builds data frames from arrays of records, and checks whether input is valid JSON; Get started shows each of these.

Learn more

zujson is narrower than jsonlite by design; use jsonlite when you need matrices, custom serializers or input too large to hold in memory.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.