Skip to contents

Wraps a data frame in standard API envelope with metadata and serializes to JSON. Used by [plan_api] targets to produce static JSON files.

Usage

generate_api_endpoint(data, dataset_name, description)

Arguments

data

A data frame to serialize, or NULL if data is unavailable

dataset_name

Short name for this dataset (e.g. "clinical")

description

Human-readable description

Value

A JSON string (character scalar) with `metadata` and `data` fields

Examples

if (FALSE) { # \dontrun{
df <- data.frame(a = 1:3, b = letters[1:3])
json <- generate_api_endpoint(df, "example", "Example data")
cat(json)
} # }