Learn R Programming

whapi (version 0.0.2)

whapi_to_pretty_json: Convert R objects into pretty JSON (character)

Description

Wrapper around jsonlite::toJSON() to serialize lists/data.frames into human-readable JSON for logging or persistence. Returns NA_character_ if jsonlite is not installed or conversion fails.

Usage

whapi_to_pretty_json(x)

Value

Character scalar containing pretty-printed JSON, or NA_character_.

Arguments

x

Any R object (list, vector, data.frame).

Examples

Run this code
whapi_to_pretty_json(list(a=1, b=2))
whapi_to_pretty_json(mtcars[1:2,1:2])

Run the code above in your browser using DataLab