cbordec: CBOR Decode

View source: R/base.R

cbordecR Documentation

CBOR Decode

Description

Decode CBOR (Concise Binary Object Representation, RFC 8949) data to an R object.

Usage

cbordec(x)

Arguments

x

A raw vector containing CBOR-encoded data.

Details

CBOR types map to R types as follows:

  • Integers: integer (if within range) or double

  • Float16/Float32/Float64: double

  • Byte strings: raw vectors

  • Text strings: character

  • false/true: logical

  • null: NULL

  • undefined: NA

  • Arrays: lists

  • Maps: named lists (keys must be text strings)

Note: CBOR arrays always decode to lists, so R atomic vectors encoded via cborenc() will decode to lists rather than vectors.

Value

The decoded R object.

See Also

cborenc()

Examples

# Round-trip encoding
original <- list(a = 1L, b = "test", c = TRUE)
cbordec(cborenc(original))


secretbase documentation built on Feb. 5, 2026, 9:09 a.m.