Skip to content

Conversation

tsibley
Copy link

@tsibley tsibley commented Aug 1, 2014

Two of the three callsites affected calls to toJSON() with the ANY
signature, but the most obvious defect was when calling toJSON() on a
list().

The test tries to serialize what could be thought of as a nested hash,
and fails if run on the code before this commit.

…without it

Two of the three callsites affected calls to toJSON() with the ANY
signature, but the most obvious defect was when calling toJSON() on a
list().

The test tries to serialize what could be thought of as a nested hash,
and fails if run on the code before this commit.
tsibley added a commit to tsibley/rPython that referenced this pull request Aug 4, 2014
The following simplified example now works:

    python.assign("foo", list( "key" = c( "subkey" = 13, "anotherkey" = 42 ) ));

A bug in RJSONIO causes toJSON() not to fully-respect the collapse
parameter, so we still do sometimes have newlines despite setting
collapse to the empty string [1].  Using triple single quotes in Python
works around the issue and is more robust anyhow.  Prefixing the Python
string with "r" means that literal escape codes in the JSON itself won't
be interpreted first by Python.  Both of these issues were addressed in
python.call() in previous commits.

The auto-flattening behaviour is also adjusted to only apply to lists.
len(hash) will equal 1 with only a single key in hash, but it shouldn't
be flattened.

[1] Patch: tsibley/RJSONIO@c9196f8 and
    Pull request: duncantl/RJSONIO#15
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