rPython-win icon indicating copy to clipboard operation
rPython-win copied to clipboard

Remove newline characters from JSON

Open jranke opened this issue 10 years ago • 0 comments

Thanks for this nice package!

In some cases (did not figure out when and when not), toJSON leads to representations like

> toJSON(x_2)
[1] "[ [\n \"Scenario\",\n\"Waterbody\", ....

instead of

> toJSON(x_1)
[1] "[ [ \"Scenario\", \"Waterbody\", ...

which makes python.assign fail with the message

SyntaxError: EOL while scanning string literal

This can be avoided by substituting the newline characters in the JSON string before it is passed to the Python interpreter.

I am not clear what the difference between the code in this github project and the r-forge project is, this also applies to the code on r-forge. I only submitted the fix here, as it is easier on github.

jranke avatar Mar 20 '15 13:03 jranke