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
When calling to_json on an object like {foo: undefined}, it should result in {} and not panic. Here are some various behaviors (demo's using Node) which it would be good to follow:
The current workaround is to return JSON.parse(JSON.stringify(objectContainingUndefineds)). However, as I'm using Boa to build a plugin system, I wouldn't expect users to have to do this themselves.
Another potential workaround is to recursively crawl the JSValue and remove undefined values from all the objects and arrays.
Thanks for taking the time to look into this!
The text was updated successfully, but these errors were encountered:
Describe the bug
When calling
to_json
on an object like{foo: undefined}
, it should result in{}
and not panic. Here are some various behaviors (demo's using Node) which it would be good to follow:For context, I'm building a 3rd-party plugin system for Yaak using Boa and users may return a nested data structure that contain
undefined
values.To Reproduce
Return an object from the JS context and call
to_json
on it.Expected behavior
The value should serialize to
{}
and not thrownot yet implemented: undefined to JSON
.Build environment (please complete the following information):
aarch64-apple-darwin
rustc 1.77.2 (25ef9e3d8 2024-04-09)
Additional context
The current workaround is to return
JSON.parse(JSON.stringify(objectContainingUndefineds))
. However, as I'm using Boa to build a plugin system, I wouldn't expect users to have to do this themselves.Another potential workaround is to recursively crawl the
JSValue
and remove undefined values from all the objects and arrays.Thanks for taking the time to look into this!
The text was updated successfully, but these errors were encountered: