from_reader

Function from_reader 

Source
pub fn from_reader<R, T>(reader: R) -> Result<T>
where R: Read, T: DeserializeOwned,
Expand description

Deserialize an instance of type T from an IO stream of JSON.

This function provides the same API as serde_json::from_reader but returns enhanced errors with path tracking.

§Example

use serde::Deserialize;
use serde_json_diagnostics::from_reader;
use std::io::Cursor;

#[derive(Deserialize)]
struct Data {
    value: i32,
}

let json = r#"{"value": 42}"#;
let reader = Cursor::new(json);
let data: Data = from_reader(reader)?;

§Note on Path Tracking

Path tracking implementation is pending completion in Phase 4. Currently, this function uses serde_json internally without path information.