{"id":29596232,"url":"https://github.com/rhbvkleef/dict_deserializer","last_synced_at":"2026-04-13T08:31:59.847Z","repository":{"id":33276786,"uuid":"157204021","full_name":"rhbvkleef/dict_deserializer","owner":"rhbvkleef","description":"A JSON-oriented converter and validator","archived":false,"fork":false,"pushed_at":"2022-12-26T21:38:33.000Z","size":116,"stargazers_count":1,"open_issues_count":7,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-14T05:05:26.730Z","etag":null,"topics":["deserialization","json","python","python3","type-hints"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rhbvkleef.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-12T11:35:09.000Z","updated_at":"2021-05-17T12:07:36.000Z","dependencies_parsed_at":"2023-01-15T00:18:44.704Z","dependency_job_id":null,"html_url":"https://github.com/rhbvkleef/dict_deserializer","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/rhbvkleef/dict_deserializer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhbvkleef%2Fdict_deserializer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhbvkleef%2Fdict_deserializer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhbvkleef%2Fdict_deserializer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhbvkleef%2Fdict_deserializer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rhbvkleef","download_url":"https://codeload.github.com/rhbvkleef/dict_deserializer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhbvkleef%2Fdict_deserializer/sbom","scorecard":{"id":774107,"data":{"date":"2025-08-18","repo":{"name":"github.com/rhbvkleef/dict_deserializer","commit":"de2e0a8b2d6cc18547a495a769e2b24bee53756e"},"scorecard":{"version":"v5.2.1-41-g40576783","commit":"40576783fda6698350fcbbeaea760ff827433034"},"score":2.5,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint-and-test.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/rhbvkleef/dict_deserializer/lint-and-test.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/lint-and-test.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/rhbvkleef/dict_deserializer/lint-and-test.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/lint-and-test.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/rhbvkleef/dict_deserializer/lint-and-test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/rhbvkleef/dict_deserializer/publish.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/rhbvkleef/dict_deserializer/publish.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   3 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 0/20 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/lint-and-test.yml:1","Warn: no topLevel permission defined: .github/workflows/publish.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: BSD 3-Clause \"New\" or \"Revised\" License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"29 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2022-42986 / GHSA-43fp-rhv2-5gv8","Warn: Project is vulnerable to: PYSEC-2023-135 / GHSA-xqr8-7jwr-rhp7","Warn: Project is vulnerable to: GHSA-3ww4-gg4f-jr7f","Warn: Project is vulnerable to: GHSA-5cpq-8wj7-hf2v","Warn: Project is vulnerable to: GHSA-9v9h-cgj8-h64p","Warn: Project is vulnerable to: PYSEC-2023-254 / GHSA-jfhm-5ghh-2f97","Warn: Project is vulnerable to: GHSA-jm77-qphf-c4w8","Warn: Project is vulnerable to: GHSA-v8gr-m533-ghj9","Warn: Project is vulnerable to: GHSA-w7pp-m8wf-vj6r","Warn: Project is vulnerable to: GHSA-x4qr-2fvf-3mr5","Warn: Project is vulnerable to: PYSEC-2024-60 / GHSA-jjg7-2v4v-x38h","Warn: Project is vulnerable to: GHSA-cpwx-vrp4-4pq7","Warn: Project is vulnerable to: GHSA-h5c8-rqwp-cp95","Warn: Project is vulnerable to: GHSA-h75v-3vvj-5mfj","Warn: Project is vulnerable to: GHSA-q2x7-8rv6-6q7h","Warn: Project is vulnerable to: PYSEC-2022-6 / GHSA-qc9x-gjcv-465w","Warn: Project is vulnerable to: PYSEC-2023-117 / GHSA-mrwq-x4v8-fh7p","Warn: Project is vulnerable to: GHSA-9hjg-9r4m-mvj7","Warn: Project is vulnerable to: GHSA-9wx4-h78v-vm56","Warn: Project is vulnerable to: PYSEC-2023-74 / GHSA-j8r2-6x86-q33q","Warn: Project is vulnerable to: GHSA-g7vv-2v7x-gj9p","Warn: Project is vulnerable to: GHSA-34jh-p97f-mpxf","Warn: Project is vulnerable to: PYSEC-2023-212 / GHSA-g4mx-q9vg-27p4","Warn: Project is vulnerable to: GHSA-pq67-6m6q-mj2v","Warn: Project is vulnerable to: PYSEC-2021-108 / GHSA-q2q7-5pp4-w6pg","Warn: Project is vulnerable to: PYSEC-2023-192 / GHSA-v845-jxx5-vc9f","Warn: Project is vulnerable to: PYSEC-2024-187 / GHSA-rqc4-2hc7-8c8v","Warn: Project is vulnerable to: PYSEC-2022-43017 / GHSA-qwmp-2cf2-g9g6","Warn: Project is vulnerable to: GHSA-jfmj-5v4g-7637"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 12 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T03:04:16.843Z","repository_id":33276786,"created_at":"2025-08-23T03:04:16.843Z","updated_at":"2025-08-23T03:04:16.843Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31746101,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T06:26:45.479Z","status":"ssl_error","status_checked_at":"2026-04-13T06:26:44.645Z","response_time":93,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["deserialization","json","python","python3","type-hints"],"created_at":"2025-07-20T09:13:05.051Z","updated_at":"2026-04-13T08:31:59.828Z","avatar_url":"https://github.com/rhbvkleef.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dictionary deserializer\n[![ReadTheDocs](https://readthedocs.org/projects/dict-deserializer/badge/?version=latest\u0026style=flat)](https://dict-deserializer.rtfd.io)\n[![GitHub issues](https://img.shields.io/github/issues/rhbvkleef/dict_deserializer.svg)](https://github.com/rhbvkleef/dict_deserializer)\n[![GitHub pull requests](https://img.shields.io/github/issues-pr/rhbvkleef/dict_deserializer.svg)](https://github.com/rhbvkleef/dict_deserializer)\n[![PyPI](https://img.shields.io/pypi/v/dictionary-deserializer.svg)](https://pypi.org/project/Dictionary-deserializer/)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/dictionary-deserializer.svg)](https://pypi.org/project/Dictionary-deserializer/)\n[![GitHub](https://img.shields.io/github/license/rhbvkleef/dict_deserializer.svg)](https://opensource.org/licenses/BSD-3-Clause)\n\nDictionary deserializer is a project built to convert dictionaries into\ncomposite classes in an intuitive way. Special attention was also paid\nto being friendly to static type-checkers and IDE autocompletes.\n\nIt is expected that this library is used together with a JSON-to-dict\ndeserializer like `json.loads`.\n\n## Installation\n\nIn order to use it, simply add the dependency `dictionary-deserializer` to your\nrequirements file:\n\n### Pipenv\n\n```bash\npipenv install dictionary-deserializer\n```\n\n### Pip\n\n```bash\npip install dictionary-deserializer\npip freeze \u003e requirements.txt\n```\n\n## Design\n\nThis project was originally meant as a proof of concept, to be used to find\nother projects that would be able to replace this, with the required feature\nset. That project was not found, and therefore, this project was expanded.\n\n### Requirements\n\n* Use type hints for type validation\n* Allow polymorphism\n    * Through `typing.Union`s\n    * Through subclassing\n* Support a large part of the `typing` module's types\n* Allow validations on values\n* Be able to validate and deserialize _any_ compliant JSON structure\n* Be compatible with static type checkers and IDE hinting\n* Have a small impact on existing code starting to use this library\n\n## Examples\n\nNone of this code is actually useful if you don't understand how to use it. It\nis very simple. Here are some examples:\n\n### Specifying a structure\n\n```python\nfrom typing import Optional\n\nfrom dict_deserializer.deserializer import Deserializable\n\nclass User(Deserializable):\n    email: str                  # Type must be a string\n    username: str               # Type must be a string\n    password: Optional[str]     # Type must either be a string or a None\n```\n\n### Deserialization\n\n```python\nfrom dict_deserializer.deserializer import deserialize, Rule\n\n# Successful\ndeserialize(Rule(User), {\n    'email': 'pypi@rolfvankleef.nl',\n    'username': 'rkleef',\n})\n\n# Fails because optional type is wrong\ndeserialize(Rule(User), {\n    'email': 'pypi@rolfvankleef.nl',\n    'username': 'rkleef',\n    'password': 9.78,\n})\n```\n\n### Polymorphic structures\n```python\nfrom typing import Optional, Any, List\n\nfrom dict_deserializer.deserializer import Deserializable\nfrom dict_deserializer.annotations import abstract\n\n@abstract\nclass DirectoryObject(Deserializable):\n    name: str\n    meta: Any\n\nclass User(DirectoryObject):\n    full_name: str\n    first_name: Optional[str]\n\nclass Group(DirectoryObject):\n    members: List[DirectoryObject]\n```\n\nIf you deserialize into `Rule(DirectoryObject)`, the matching class will\nautomatically be selected. If none of the subclasses match, an error is thrown\nsince the DirectoryObject is declared abstract.\n\nIf you want to discriminate not by field names or types, but by their values,\none can choose to define a `@discriminator` annotation.\n\n### Value validations\n\nThe syntax for validating the value of a key is currently a bit weird. It is\nincompatible with existing syntax for defaults, but the type syntax is the same.\n\nExample:\n\n```python\nfrom typing import Optional\n\nfrom dict_deserializer.deserializer import Deserializable\nfrom dict_deserializer.annotations import validated\n\nclass Test(Deserializable):\n    name: Optional[str]\n    \n    @validated(default='Unknown')\n    def name(self, value):\n        if len(value) \u003e 20:\n            raise TypeError('Name may not be longer than 20 characters.')\n\n```\n\n## Limitations\n\nThis library uses the `typing` module extensively. It does, however, only\nsupport some of its types. This is a list of verified composite types:\n\n* `Union` (Including `Optional`)\n* `Dict`\n* `List`\n* `Tuple`\n* `Any`\n* `dict_deserializer.deserializer.Deserializable`\n* `dict`\n* `list`\n\nIt supports these types as terminal types:\n\n* `int`\n* `float`\n* `str`\n* `NoneType`\n* `bool`\n\n## Planned features\n\n* NamedTuples\n    * The anonymous namedtuple and the class-namedtuples with (optionally) type annotations.\n* Dataclasses\n* A way to allow deserializing into a class not extending `Deserializable`\n* Enums\n* Sets\n    * From lists\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhbvkleef%2Fdict_deserializer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frhbvkleef%2Fdict_deserializer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhbvkleef%2Fdict_deserializer/lists"}