These functions create intermediate definitions for basic JSON atomic types
(integer, number/double, string, boolean). These definitions are used within
s_vector()
or s_map()
and finalized by build_structure()
.
Details
s_integer()
: Expects a JSON integer that fits within R's 32-bit signed integer range. Allows JSON numbers without fractional parts (e.g.,123.0
).s_double()
: Expects any JSON number (integer or float).s_string()
: Expects a JSON string.s_logical()
: Expects a JSON boolean (true
orfalse
).
Examples
build_structure(s_integer()) # list(type = "integer")
#> Integer
build_structure(s_double()) # list(type = "double")
#> Double
build_structure(s_string()) # list(type = "string")
#> String
build_structure(s_logical()) # list(type = "logical")
#> Logical