Learn R Programming

jsontools (version 0.1.0)

json_u: Unbox a vector or data frame

Description

Mark a vector of length one to not be wrapped in an array when formatted as JSON. This is only a tiny wrapper around jsonlite::unbox() to avoid conflict with rlang::unbox().

Usage

json_u(x)

Arguments

x

atomic vector of length 1, or data frame with 1 row.

Value

A singleton version of x.

Examples

Run this code
# NOT RUN {
format_json(list(foo = 123))
format_json(list(foo = json_u(123)))
# }

Run the code above in your browser using DataLab