graaljs icon indicating copy to clipboard operation
graaljs copied to clipboard

[interop] Hash support for `JSON.stringify()`?

Open fniephaus opened this issue 4 years ago • 2 comments

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 avatar Jul 01 '21 08:07 fniephaus

@fniephaus thanks for reporting the issue, we will check it out and get back to you

munishchouhan avatar Jul 05 '21 03:07 munishchouhan

@fniephaus I have raised this issue with our dev team

munishchouhan avatar Aug 19 '21 08:08 munishchouhan