powered by
Minimal JSON parser. Converts JSON to R objects with proper type handling.
jsondec(x)
The corresponding R object, or an empty list for invalid input.
Character string or raw vector containing JSON data.
Object {} -> named list
{}
Array [] -> unnamed list
[]
String -> character
Number -> numeric
true/false -> logical
true
false
null -> NULL
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").
\\uZZZZ
"uZZZZ"
Incomplete Unicode escape sequences for emoji are tolerated.
Nesting depth is limited to 512 levels.
This is a minimal implementation designed for parsing HTTP API responses.
jsonenc()
jsondec('{"name": "John", "age": 30}') jsondec('[1, 2, 3]') jsondec('"a string"') jsondec('123') jsondec('true')
Run the code above in your browser using DataLab