jsonlite
jsonlite copied to clipboard
Feature request: specify `na` strings in `fromJSON`
Most R import/export data tools have the ability to customize the NA strings. It would be neat if jsonlite did this too.
I'd imagine something like
fromJSON('["a", "b", "."]', na = ".")
# "a" "b" NA
For consistency, the way the na argument in toJSON would also need to be modified to allow
toJSON(c("a", "b", NA), na = ".")
# ["a","b","."]
I got the idea from some guy's SO post.
I could probably fork, modify, and submit a pull request in the next week or two if you're interested.
I am having a related problem.
I'm reading a JSON string that contains the strings "NA" - and I need them to remain as character class, not R's reserved NA value.
If the above is implemented, and I could specify na=NULL to have no JSON string values convert to NAs, that would be useful.