{"id":16893132,"url":"https://github.com/dtolnay/serde-ignored","last_synced_at":"2025-05-15T23:08:26.307Z","repository":{"id":48301348,"uuid":"81390451","full_name":"dtolnay/serde-ignored","owner":"dtolnay","description":"Find out about keys that are ignored when deserializing data","archived":false,"fork":false,"pushed_at":"2025-03-03T07:50:46.000Z","size":170,"stargazers_count":81,"open_issues_count":7,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-08T13:42:22.834Z","etag":null,"topics":["serde"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dtolnay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"dtolnay"}},"created_at":"2017-02-09T00:20:25.000Z","updated_at":"2025-04-23T20:58:20.000Z","dependencies_parsed_at":"2024-10-30T18:00:46.102Z","dependency_job_id":"9b5d2b36-81b2-4575-b61b-b3a246df5dcc","html_url":"https://github.com/dtolnay/serde-ignored","commit_stats":{"total_commits":116,"total_committers":2,"mean_commits":58.0,"dds":"0.025862068965517238","last_synced_commit":"5727122185231677f37f012610e1d6ee1a9e3d80"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtolnay%2Fserde-ignored","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtolnay%2Fserde-ignored/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtolnay%2Fserde-ignored/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtolnay%2Fserde-ignored/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dtolnay","download_url":"https://codeload.github.com/dtolnay/serde-ignored/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254436949,"owners_count":22070947,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["serde"],"created_at":"2024-10-13T17:13:46.562Z","updated_at":"2025-05-15T23:08:20.615Z","avatar_url":"https://github.com/dtolnay.png","language":"Rust","funding_links":["https://github.com/sponsors/dtolnay"],"categories":[],"sub_categories":[],"readme":"# Serde ignored\n\n[\u003cimg alt=\"github\" src=\"https://img.shields.io/badge/github-dtolnay/serde--ignored-8da0cb?style=for-the-badge\u0026labelColor=555555\u0026logo=github\" height=\"20\"\u003e](https://github.com/dtolnay/serde-ignored)\n[\u003cimg alt=\"crates.io\" src=\"https://img.shields.io/crates/v/serde_ignored.svg?style=for-the-badge\u0026color=fc8d62\u0026logo=rust\" height=\"20\"\u003e](https://crates.io/crates/serde_ignored)\n[\u003cimg alt=\"docs.rs\" src=\"https://img.shields.io/badge/docs.rs-serde__ignored-66c2a5?style=for-the-badge\u0026labelColor=555555\u0026logo=docs.rs\" height=\"20\"\u003e](https://docs.rs/serde_ignored)\n[\u003cimg alt=\"build status\" src=\"https://img.shields.io/github/actions/workflow/status/dtolnay/serde-ignored/ci.yml?branch=master\u0026style=for-the-badge\" height=\"20\"\u003e](https://github.com/dtolnay/serde-ignored/actions?query=branch%3Amaster)\n\nFind out about keys that are ignored when deserializing data. This crate\nprovides a wrapper that works with any existing Serde `Deserializer` and invokes\na callback on every ignored field.\n\nYou can use this to warn users about extraneous keys in a config file, for\nexample.\n\nNote that if you want unrecognized fields to be an error, consider using the\n`#[serde(deny_unknown_fields)]` [attribute] instead.\n\n[attribute]: https://serde.rs/attributes.html\n\n```toml\n[dependencies]\nserde = \"1.0\"\nserde_ignored = \"0.1\"\n```\n\n```rust\nuse serde::Deserialize;\nuse std::collections::{BTreeSet as Set, BTreeMap as Map};\n\n#[derive(Debug, PartialEq, Deserialize)]\nstruct Package {\n    name: String,\n    dependencies: Map\u003cString, Dependency\u003e,\n}\n\n#[derive(Debug, PartialEq, Deserialize)]\nstruct Dependency {\n    version: String,\n}\n\nfn main() {\n    let j = r#\"{\n        \"name\": \"demo\",\n        \"dependencies\": {\n            \"serde\": {\n                \"version\": \"1.0\",\n                \"typo1\": \"\"\n            }\n        },\n        \"typo2\": {\n            \"inner\": \"\"\n        },\n        \"typo3\": {}\n    }\"#;\n\n    // Some Deserializer.\n    let jd = \u0026mut serde_json::Deserializer::from_str(j);\n\n    // We will build a set of paths to the unused elements.\n    let mut unused = Set::new();\n\n    let p: Package = serde_ignored::deserialize(jd, |path| {\n        unused.insert(path.to_string());\n    }).unwrap();\n\n    // Deserialized as normal.\n    println!(\"{:?}\", p);\n\n    // There were three ignored keys.\n    let mut expected = Set::new();\n    expected.insert(\"dependencies.serde.typo1\".to_owned());\n    expected.insert(\"typo2\".to_owned());\n    expected.insert(\"typo3\".to_owned());\n    assert_eq!(unused, expected);\n}\n```\n\n\u003cbr\u003e\n\n#### License\n\n\u003csup\u003e\nLicensed under either of \u003ca href=\"LICENSE-APACHE\"\u003eApache License, Version\n2.0\u003c/a\u003e or \u003ca href=\"LICENSE-MIT\"\u003eMIT license\u003c/a\u003e at your option.\n\u003c/sup\u003e\n\n\u003cbr\u003e\n\n\u003csub\u003e\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in this crate by you, as defined in the Apache-2.0 license, shall\nbe dual licensed as above, without any additional terms or conditions.\n\u003c/sub\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdtolnay%2Fserde-ignored","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdtolnay%2Fserde-ignored","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdtolnay%2Fserde-ignored/lists"}