Question: How to detect primitive type?
shi-yan opened this issue · 1 comments
shi-yan commented
I'm trying to convert a js object into serde_json::Value,
First, I got a list of properties via get_own_property_names() and then I enumerator through all properties to get JsValues.
But I don't know how to convert each JsValue into the corresponding rust type, because how can I check the data type of a JsValue?
This is not mentioned in the document.
Thanks.
kjvalencik commented
downcast
and is_a
.
Overview of type hierarchy:
https://docs.rs/neon/latest/neon/types/index.html
downcast
: https://docs.rs/neon/latest/neon/handle/struct.Handle.html#method.downcast