Preserve the collapse parameter in the remaining recursive callsites 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.