Skip to main content

cast_to_f64

Function cast_to_f64 

Source
pub fn cast_to_f64(value: &Value) -> Result<f64, String>
Expand description

Renders a JSON value as a number leaf (cast.ToFloat64E).

A witness method that receives a leaf as raw JSON, rather than as a generated field, renders it through this so that 1 and "1.5" read as the Agent reads them (1.0 and 1.5) instead of rejecting their JSON spelling.

ยงErrors

Returns an error for a value the Agent cannot cast to a number: a non-numeric string or a compound value.