parse_json_str_with_fallback

Function parse_json_str_with_fallback 

Source
pub fn parse_json_str_with_fallback<T: DeserializeOwned>(
    raw: &str,
) -> Result<(T, String)>
Available on crate feature scraper only.
Expand description

Parse JSON from a raw string with a cleaning fallback.

Tries to deserialize from the original raw first. If it fails, removes illegal control characters using replace_control_chars and retries. Returns the parsed value and the raw string that was successfully used.

ยงErrors

Returns an error when both the original and cleaned strings fail to deserialize.