Registry / serialization / serde-path-to-error

serde-path-to-error

JSON →
library0.1.20rscratesunverified

Path to the element that failed to deserialize

# Cargo.toml [dependencies] serde_path_to_error = "0.1.20"
INSTALL
IMPORT
SIG · SERDE-PATH-TO-ERRO
S
serde-path-to-error
serializationrustv0.1.20
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Error
use serde_path_to_error::Error;

Track the path to the field that caused a deserialization error

use serde_path_to_error::Error; use serde::Deserialize; #[derive(Deserialize)] struct Config { name: String, version: u32, } let data = r#"{"name": "test", "version": "not_a_number"}"#; let result: Result<Config, _> = serde_path_to_error::deserialize(&mut serde_json::Deserializer::from_str(data)); match result { Err(err) => println!("Error at path: {}", err.path()), Ok(_) => {} }
Debug
Known issues

No known issues recorded.

Upgrade
Version history
0.1.20latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
12
Resources
serde-path-to-error — cargo add serde-path-to-error · libregistry