extendr / extendr

R extension library for rust designed to be familiar to R users.
https://extendr.github.io
MIT License
426 stars 43 forks source link

extendr::serializer::to_robj serializes integers as numerics #840

Open JosiahParry opened 4 weeks ago

JosiahParry commented 4 weeks ago
rextendr::rust_function(r"-{
fn tst() -> Robj {
  let x = serde_json::Value::from(serde_json::Number::from(10i32));
  extendr_api::serializer::to_robj(&x).unwrap()
}
}-", features = "serde", dependencies = list("serde_json" = "*"))

tst() |> class()
#> [1] "numeric"
JosiahParry commented 4 weeks ago

I wanted to give this a shot but I don't know where this is being serialized. If anyone has an idea, I can give it a shot.

CGMossa commented 4 weeks ago

First, nice find. Second of all, I want to make you aware that the serializer doesn't really work with NA at the moment.

I also think that the path you're looking for starts with: