Is it possible to pass variable from gateway scope to client scope?

In my case, it was a bit more hard to spot, as some values that had come through Perspective properties at some point had been turned into PropertyTreeScriptWrapper$ObjectWrapper and PropertyTreeScriptWrapper$ArrayWrapper elements that were very good at imitating dicts and lists until they got into jsonEncode.

It’s got barely minutes of testing on it, but this snippet of code helped me spot my bad elements:

[EDIT: Removed this snippet as I put a more robust one over on this post.]