Skip to main content

parse_json_or_default

Function parse_json_or_default 

Source
pub fn parse_json_or_default<T: for<'de> Deserialize<'de> + Default>(
    input: &str,
    label: &str,
) -> T
Expand description

Parse JSON into a typed value, falling back to Default on failure.

A parse failure is logged at debug level with the provided label so the failure is visible in traces without being fatal.