sonic-rs icon indicating copy to clipboard operation
sonic-rs copied to clipboard

Can't get rust_decimal::arbitrary_precision to work

Open Scooter1337 opened this issue 10 months ago • 1 comments

Serde_Json this returns value: 10.000, Sonic_rs this returns value: 10

use rust_decimal::Decimal;
use serde::{Deserialize, Serialize};

fn main() {
    let result: ArbitraryExample = sonic_rs::from_slice(b"{\"value\": 10.000}").unwrap();

    dbg!(result);
}

#[derive(Serialize, Deserialize, Debug)]
pub struct ArbitraryExample {
    #[serde(with = "rust_decimal::serde::arbitrary_precision")]
    value: Decimal,
}

Scooter1337 avatar Mar 04 '25 09:03 Scooter1337

I reproduced it, we will fix it

liuq19 avatar Mar 06 '25 02:03 liuq19