You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have created a small repo which contains a reproduction case for this. To see the issue for yourself clone it and run it using dotnet test. This might be a duplicate of #347, although I want to specifically point out the behaviour relating to ExpandoObject instead of a statically-typed class instance.
If an ExpandoObject is added into a Jint environment via SetValue & subsequently an attempt is made to JSON.stringify(theExpando), this will always produce a result of "{}". Instead I think it should produce appropriate results for the state of that expando object.
This is particularly troublesome because of the behaviour of JSON.parse. When using JSON.parse('{"foo":5,"bar":"A string"}'), Jint will return an expando back to "the .NET world". That's understandable; I don't think any other behaviour would make any sense. Unfortunately, that returned object then can't be round-tripped back to JSON by executing JS via Jint, because of this issue.
The text was updated successfully, but these errors were encountered:
I forgot to mention, one of the test cases in the repro repository does pass. It shows how it stringifies correctly if you give Jint a Dictionary<string,object>. It's possible to convert expandos to that, so that might be a viable workaround for those who run into this.
I have created a small repo which contains a reproduction case for this. To see the issue for yourself clone it and run it using
dotnet test
. This might be a duplicate of #347, although I want to specifically point out the behaviour relating toExpandoObject
instead of a statically-typed class instance.If an
ExpandoObject
is added into a Jint environment viaSetValue
& subsequently an attempt is made toJSON.stringify(theExpando)
, this will always produce a result of"{}"
. Instead I think it should produce appropriate results for the state of that expando object.This is particularly troublesome because of the behaviour of
JSON.parse
. When usingJSON.parse('{"foo":5,"bar":"A string"}')
, Jint will return an expando back to "the .NET world". That's understandable; I don't think any other behaviour would make any sense. Unfortunately, that returned object then can't be round-tripped back to JSON by executing JS via Jint, because of this issue.The text was updated successfully, but these errors were encountered: