Skip to main content

partial_parse_json

Function partial_parse_json 

Source
pub fn partial_parse_json(json: &str, config: &PartialConfig) -> PartialResult
Expand description

Parse JSON string with partial error recovery

This function attempts to parse as much of the JSON as possible, collecting errors instead of failing on the first error.

ยงExamples

use hedl_json::from_json::{partial_parse_json, PartialConfig, ErrorTolerance};

let json = r#"{"valid": "data", "invalid": ...}"#;
let config = PartialConfig::builder()
    .tolerance(ErrorTolerance::CollectAll)
    .build();

let result = partial_parse_json(json, &config);
assert!(result.document.is_some());
assert!(!result.errors.is_empty());