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'm using deno embedded in a rust application and we're facing an issue with the serde_v8 with some objects.
At some point in our script we call await Deno.core.opAsync('success', message);
This message on the script side is an object, such as:
{lines: {100: {unit: "m"},200: {unit: "cm"}}}
On the rust side, my success function expects a serde_json::Value object. This is failing to be serialised back to rust because it cannot handle the numbers as keys. Shouldn't deno convert them to string in this case?
Even if I set the object like this:
{lines: {"100": {unit: "m"},"200": {unit: "cm"}}}
deno still treats it as a number and fails to parse it.
The text was updated successfully, but these errors were encountered:
@AaronO pointed out it's caused by rusty_v8's Object::get_own_property_names() using KeyConversionMode::kKeepNumbers (default inherited from V8's C++ API), whereas for this particular case you'd want kConvertToString or kNoNumbers.
To summarize: needs a change in rusty_v8 before it can be fixed in deno.
kitsonk
added
deno_core
Changes in "deno_core" crate are needed
upstream
Changes in upstream are required to solve these issues
bug
Something isn't working correctly
labels
Jul 29, 2021
I'm using deno embedded in a rust application and we're facing an issue with the
serde_v8
with some objects.At some point in our script we call
await Deno.core.opAsync('success', message);
This
message
on the script side is an object, such as:On the rust side, my
success
function expects aserde_json::Value
object. This is failing to be serialised back to rust because it cannot handle the numbers as keys. Shouldn't deno convert them to string in this case?Even if I set the object like this:
deno still treats it as a number and fails to parse it.
The text was updated successfully, but these errors were encountered: