I’m working in R with a dataframe containing a column with escaped unicode sequences:
d <- data.frame(id = 1, norm = "mu0350piniu0306u030Dsu0313u")
I ultimately need to import the dataframe into MongoDB (I’m using Compass) so that the corresponding unicode characters are correctly displayed. I tried saving it to a simple tab delimited text file, but MongoDB treats the unicode column as a string; so I tried saving it as a json
:
library(jsonlite)
j <- tojson(d,dataframe="rows",pretty=T)
write(j,"jtest.json")
However, this automatically adds another backslash to the escaped sequences, giving m\u0350pini\u0306\u030Ds\u0313u
, which again MongoDB does not interpret as unicode.
If I insert a document into MongoDB manually which single backslashes, the unicode symbols appear, but this is very impractical for me (thousands of documents).
What am I doing wrong?
Thanks for the help.