Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: specify na strings in fromJSON #98

Open
gregorp opened this issue Apr 29, 2015 · 1 comment
Open

Feature request: specify na strings in fromJSON #98

gregorp opened this issue Apr 29, 2015 · 1 comment

Comments

@gregorp
Copy link

gregorp commented Apr 29, 2015

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.

@rcalme
Copy link

rcalme commented Aug 31, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants