| jsondec | R Documentation |
Minimal JSON parser. Converts JSON to R objects with proper type handling.
jsondec(x)
x |
Character string or raw vector containing JSON data. |
This is a minimal implementation designed for parsing HTTP API responses.
The corresponding R object, or an empty list for invalid input.
Object {} -> named list
Array [] -> unnamed list
String -> character
Number -> numeric
true/false -> logical
null -> NULL
Invalid JSON returns an empty list instead of erroring.
Duplicate keys are preserved; R accessors ($, [[) return first
match.
Non-standard number forms may be accepted (e.g., leading zeros, hexadecimal).
Invalid escape sequences are output literally (e.g., \\uZZZZ
becomes "uZZZZ").
Incomplete Unicode escape sequences for emoji are tolerated.
Nesting depth is limited to 512 levels.
jsonenc()
jsondec('{"name": "John", "age": 30}')
jsondec('[1, 2, 3]')
jsondec('"a string"')
jsondec('123')
jsondec('true')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.