Converts R objects to a JSON string for easier inspection in logs.
Falls back to utils::str() output if jsonlite is not available
or if JSON conversion fails. Long outputs are truncated with whapi_trunc.
Examples
whapi_log_pretty_json(list(a = 1, b = "test"))
#> [1] "{\n \"a\": 1,\n \"b\": \"test\"\n}"
whapi_log_pretty_json(mtcars[1:2, ], max = 100)
#> [1] "[\n {\n \"mpg\": 21,\n \"cyl\": 6,\n \"disp\": 160,\n \"hp\": 110,\n \"drat\": 3.9,\n \"wt\": 2.62,\n... (truncated)"
