Crate fuzzy_from_json_value
Source - FuzzyFromJsonValueError
- FuzzyFromJsonValue
- flatten_fields_if_present_in_value
- If
value
is an Object containing a key “fields” which is itself an Object,
lift those “fields” up one level. Then remove the “fields” key. - from_value_pathaware
- Parse
value
into T
and if there’s a structure mismatch,
you get an error message that includes a JSON pointer path
to where the mismatch occurred. - fuzzy_key_to_u8
- Convert a string key into a
u8
by fuzzily parsing it as a float or int,
then clamping to [0..255], logging if we do so. - fuzzy_map_u8
- A fuzzy deserializer for
HashMap<u8, V>
. - fuzzy_option_u8
- A fuzzy deserialization helper for
Option<u8>
. - fuzzy_option_u8_from_value
- Same idea, but for an Option with your existing fuzzy logic:
- fuzzy_u8
- fuzzy_u8_from_value
- Convert a single
&serde_json::Value
into a u8
by applying the same “fuzzy”
clamp/truncation logic as your original fuzzy_u8
function. - fuzzy_vec_u8
- A fuzzy deserialization helper for
Vec<u8>
. - get_f64_field
- Safely read a floating‐point field from
obj
, or fail if missing or not a number. - get_opt_f64_field
- Like above but optional. If missing, returns None. If present and not f64, error.
- get_string_field
- Safely read a string field from
obj
, or fail if missing or not a string. - recursively_flatten_fields