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

Remove newline characters from JSON #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Remove newline characters from JSON #3

wants to merge 1 commit into from

Conversation

jranke
Copy link

@jranke jranke commented Mar 20, 2015

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.

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.
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

Successfully merging this pull request may close these issues.

1 participant