graaljs
graaljs copied to clipboard
[interop] Hash support for `JSON.stringify()`?
While JSON.stringify() supports interop array elements, it does not take hash elements into consideration.
Here's a simple example using Python dicts:
$ polyglot --jvm --shell
GraalVM MultiLanguage Shell 21.1.0
Copyright (c) 2013-2020, Oracle and/or its affiliates
JavaScript version 21.1.0
Python version 3.8.5
Squeak/Smalltalk version 21.2.0-dev
js> JSON.stringify(Polyglot.eval('python', '[1, 2, 3, 4]'))
[1,2,3,4] // -> expected result
js> JSON.stringify(Polyglot.eval('python', '{"result": [1, 2, 3, 4]}'))
{} // -> unexpected result, should be `{"results": [1,2,3,4]}`
@fniephaus thanks for reporting the issue, we will check it out and get back to you
@fniephaus I have raised this issue with our dev team