Replies: 2 comments 9 replies
-
I still couldn't find a decent location to slot this in, but I guess I can share my current workaround. Since it isn't large JSON payloads nor performance critical, I just roundtrip through a string: if (data is JObject jObject)
data = new JsonParser(engine).Parse(jObject.ToString()); Might not be useful to everyone, but it could be a viable workaround for some. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Maybe you can find some interop ideas from STJ converter test cases that handle indexing and attach array prototype to objects when needed. |
Beta Was this translation helpful? Give feedback.
9 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
So...I thought I was done with my upgrades after #1766 but then I came across a runtime error in one of the tools I got floating around. For lack of time, that one is still on .NET 6 (other components in the project that need to be updated first) and relies on Newtonsoft.Json rather than System.Text.Json.
The runtime error was this one:
And the code is pretty innocent, easy to turn into a test method that could go into
Jint.Tests.PublicInterface\InteropTests.NewtonsoftJson.cs
:The
Evaluate
call already fails, and I tried debugging this; but I didn't really find a suitable place to slot in. I couldn't find any code dedicated to making Newtonsoft.Json work, so it probably just happens to work for the most things (with the reflection magic inObjectWrapper
.)Rather than taking the
.map
as prototype member function, it attempts to look up an array/object index with the same name (and fails.)If anyone has a good location to add this to (and/or an idea on how to do it in a sustainable way,) let me know, and I can try taking a look on the weekend.
Beta Was this translation helpful? Give feedback.
All reactions