Skip to main content

json_integer_as_u32

Function json_integer_as_u32 

Source
pub fn json_integer_as_u32(value: &Value) -> Option<u32>
Expand description

Interprets a JSON number using JSON Schema’s mathematical integer semantics and converts it to u32 when it is finite and in range.

JSON Schema treats 1, 1.0, and 1e0 as the same integer instance. serde_json deliberately keeps the latter representations as floating point numbers, so relying only on Value::as_u64 would make a Driver’s runtime parser narrower than its advertised schema.