Skip to main content

deserialize_decimal_from_json

Function deserialize_decimal_from_json 

pub fn deserialize_decimal_from_json<'de, D>(
    deserializer: D,
) -> Result<Decimal, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,
Expand description

Deserializes an exact decimal directly from a quoted or unquoted JSON token.

Works without arbitrary precision. Use before Value buffering to preserve source digits. Serde internally tagged and untagged enum buffers do not support this raw-token route.

ยงErrors

Returns an error if:

  • The input is null, an empty string, a non-decimal shape, or an invalid decimal.
  • Representing the value requires rounding.